Re: Problem with a dialog

2014-12-11 Thread Steven D'Aprano
ast wrote: > Since try() is a callback function called when a button is pushed, > with the effect to open a dialog, I tried to define MyDialog class > inside try(). The program is the following and it works. I no > longer need to define test as global. > Is it a good practice to define a class in

Re: Problem with a dialog

2014-12-11 Thread ast
"Steven D'Aprano" a écrit dans le message de news:54898820$0$12989$c3e8da3$54964...@news.astraweb.com... You can make "test" global by declaring it global: def try_(): global test test = True setup = MyDialog(root) If that solves your problem to your satisfaction, you can stop r

Re: Problem with a dialog

2014-12-11 Thread ast
"Steven D'Aprano" a écrit dans le message de news:54898820$0$12989$c3e8da3$54964...@news.astraweb.com... As I said, most programming languages work like this. But a small minority use a different system, called "dynamic scoping". In dynamic scoping, it doesn't matter *where* a function is d

Re: Problem with a dialog

2014-12-11 Thread Steven D'Aprano
ast wrote: > Hello > > I provide two almost identical small test case programs. > The first one works as expected, 'True' is printed on the > console. > With the second one Python complains that 'test' is not > known. I dont understand why. > # > ## Second >