Very practical question

Fredrik Lundh fredrik at pythonware.com
Thu Jul 6 02:35:31 EDT 2006


madpython wrote:

> Here is a short illustration:
> 
> ...
> 	self.b=Tkinter.Button(root,txt="Button",command=self.doSmth).pack()
> 	self.l=Tkinter.Label(root,txt="default").pack()
> def doSmth(self):
> 	var=globals()["m"].__dict__["progLogic"].func("some
> input")
> 	self.l.config(txt=var)
> 	self.l.update_idletasks()
> ...
> I guess it's all correct or at least it close to what I work on. What
> do you think?

what makes you think that

     var=globals()["m"].__dict__["progLogic"].func("some input")

is, in any way, different from (and superior to)

     var = m.progLogic.func("some input")

?

 > If I may I'd say it again that GUI is built according by
 > the data that's passed by the "thinking" part of the program so I
 > don't necessary know what it is (can only guess) and that's why
 > passing references as an argument doesn't seem possible.

sorry, but you make no sense at all.  solving this is not a hard pro-
blem, and the solution doesn't need to involve global variables.  and 
even if you prefer globals, there's no need to write ludicrous code.

</F>




More information about the Python-list mailing list