May-13-2020, 09:15 AM
Sorry I guess I only vaguely stated my question. I was having trouble bringing my getter value through my new_setting function.
But I found my issue. Weird combining of syntax and misplaced lines, felt like I was so far away but fairly simple fix.
Thanks Larz, I do like the idea of less code! Plus it's all my standalone program so I don't have to interface with other code so I could truly write it any way that works.
And thanks again Dean, you explain thoroughly and show great examples. I think you nailed it in your second sentence, defining rinse where my new setting is called.
For anyone who finds themselves stuck in this learning curve here's my mistakes and simple solution:
But I found my issue. Weird combining of syntax and misplaced lines, felt like I was so far away but fairly simple fix.
Thanks Larz, I do like the idea of less code! Plus it's all my standalone program so I don't have to interface with other code so I could truly write it any way that works.
And thanks again Dean, you explain thoroughly and show great examples. I think you nailed it in your second sentence, defining rinse where my new setting is called.
For anyone who finds themselves stuck in this learning curve here's my mistakes and simple solution:
from tkinter import * class Settings: def __init__(self): self._rinse = 16 @property def rinse(self): return self._rinse @rinse.setter def rinse(self, value): self._rinse = value settingsPage = Tk() settingsPage.geometry("1024x600") def new_setting(getter_name, row): #s = Settings() # I mistakenly thought the instance should be created here and combined with getter_name value_lbl = Label(text=getter_name, master=settingsPage) # previously s.getter_name value_lbl.grid(row=row, column=0) s = Settings() # the correct place for the instance new_setting(s.rinse, 1) # previously: new_setting(rinse, 1) settingsPage.mainloop()