Sep-05-2019, 03:10 PM
I think kevin wants to get the entries and save to pdf.(my interpretation),,
A couple of observations: Keep your code simple. it's easier to read and
modify later on. Start on a small scale.
You could do this with one class- this will make it easier
to pass attributes and objects. The use of the prefix self makes objects
global. Make a list of fields and use a for loop to create all you labels and entries.
Lastly I don't have the fpdf module but I hope this points you in the right direction.
Great you made a class let's deal with what you have.
you made this entry widget:
in this application. here's a way to pull the string from the entry widget:
A couple of observations: Keep your code simple. it's easier to read and
modify later on. Start on a small scale.
You could do this with one class- this will make it easier
to pass attributes and objects. The use of the prefix self makes objects
global. Make a list of fields and use a for loop to create all you labels and entries.
Lastly I don't have the fpdf module but I hope this points you in the right direction.
Great you made a class let's deal with what you have.
you made this entry widget:
def __init__(self, parent, controller): #omitting the rest.... manufacturer = tk.StringVar() manufacturer_entry = tk.Entry(self, textvariable = manufacturer, width = "30") button2 = ttk.Button(self, text="Submit", command=lambda: controller.show_frame(sub)) button2.place(x = 700, y =730)modified to:
def __init__(self, parent, controller): #omitting the rest.... self.manufacturer = tk.StringVar() manufacturer_entry = tk.Entry(self, textvariable = self.manufacturer, width = "30") button2 = ttk.Button(self, text="Submit", command= self.get_info) button2.place(x = 700, y =730) def get_info(self): manu= self.manufacturer.get() print(manu)know this also can be done without the textvariable I don't see the point in using
in this application. here's a way to pull the string from the entry widget:
def __init__(self, parent, controller): #omitting the rest.... self.manufacturer_entry = tk.Entry(self, width = "30") button2 = ttk.Button(self, text="Submit", command= self.get_info) button2.place(x = 700, y =730) def get_info(self): manu= self.manufacturer_entry.get() print(manu)