Looking for a General Method to Configure Tkinter Widgets

Rhodri James rhodri at wildebst.demon.co.uk
Tue Mar 3 21:28:13 EST 2009


On Tue, 03 Mar 2009 18:58:47 -0000, W. eWatson <notvalid2 at sbcglobal.net>  
wrote:

> I'm probably confused too.  Let's try this. In
> 	s=dialog.stopVar.get()
> I'd like to eliminate the statement and replace it with something like:
> 	s="dialog." + "stopV.get()"
> 	    )and execute that--I'm aware of the exec operation--problems)
> where StopV is a string name taken from the config file. That is, in the  
> config file there would be something like:
> stop_time = 18:00:00, stopV.

I'm trying to think of a case where opening up this security hole is
even marginally wise, and I'm failing.  If you absolutely must prat
around with indirections like this, wouldn't

   s = getattr(dialog, variable_containing_the_string_stopV).get()

be a much less unsafe idea?

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list