[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-16 Thread Javier Dehesa
Javier Dehesa added the comment: With the additional hint of garbage collection I have found now a number of examples of this behaviour (e.g. https://stackoverflow.com/questions/7439432/python-themed-tkinter-entry-variable-will-not-set). However, I haven't found actual documentation warning of

[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-16 Thread Javier Dehesa
Javier Dehesa added the comment: I see what you mean. Looking at TkDocs (not sure if this is an "official" or "officially endorsed" source or not), one of the Python examples in the "Tk Concepts" section (http://www.tkdocs.com/tutorial/concepts.html) says: > Whether or not you save the widget

[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-16 Thread Paul Moore
Paul Moore added the comment: I suspect that the problem is somehow related to garbage collection - in your failing example you don't keep any references to v or cb. I don't know what references tkinter keeps internally, it may be that this is OK because the root window is guaranteed to keep r

[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-16 Thread Javier Dehesa
Javier Dehesa added the comment: Yeah is quite subtle, I should have pointed it out... The difference is that `root.mainloop()` is called inside `make_var_cb(root)` in the first example and under `if __name__ == '__main__'` in the second one. I have experience the problem on Windows 10, and I'd

[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-16 Thread Louie Lu
Louie Lu added the comment: Sorry, but I can't see the different between your first and second code. On my Linux, it all set to check the box when it run up. Do I miss anything? -- nosy: +louielu ___ Python tracker

[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-16 Thread Javier Dehesa
Javier Dehesa added the comment: Note, this is not something specific to check buttons, the same happens with other widgets such as entries. -- ___ Python tracker ___ __

[issue30678] Widget variable binding does not work if mainloop is called from a different function

2017-06-15 Thread Javier Dehesa
New submission from Javier Dehesa: When you build a Tkinter interface with variables, if tkinter.Tk.mainloop is called from a different function that the one creating the variable objects, then in some cases the widgets associated with the variables will not be set to the right value. I have n