[Tutor] Tkinter / Variable passing
Faulconer, Steven M.
STEVEN.M.FAULCONER at saic.com
Wed Jul 21 15:38:47 CEST 2004
I hit send a little too soon. Specifics:
ActiveState Python 2.3.2
Windows 2000 SP 4
From: tutor-bounces+steven.m.faulconer=saic.com at python.org
[mailto:tutor-bounces+steven.m.faulconer=saic.com at python.org] On Behalf Of
Faulconer, Steven M.
Sent: Wednesday, July 21, 2004 9:24 AM
To: 'tutor at python.org'
Subject: [Tutor] Tkinter / Variable passing
Been working on a Tkinter/PMW application that acts as a graphical front end
to several command-line programs. The gist of the program is this:
User starts program, instantiates MainApp class. User selects a project and
a 'database' (a term for a flat file, binary database used by our software,
not an SQL-type database), and clicks the select button. This instantiates
the CheckerApp class that gives the user the option to run the various
command-line programs or view their reports. When the user clicks a button
to run a checker, it instantiates the CheckerWindow class that essentially
redirects the output of the command line program and displays it in a
Tkinter window. The user then clicks accept/cancel to accept the software
run or not accept.
This is where the issue lies. How can I tell the CheckerApp instance what
the user selected in the CheckerWindow instance? I've tried different types
of variables (global and non). I've even added a function to the CheckerApp
that I attempt to call from the CheckerWindow, which fails with an
"AttributeError" Toplevel instance has no attribute 'CheckerAccept'".
Anyone have any thoughts or ideas? Constructive criticism on the script
would be greatly appreciated. I'm fairly new to Python and VERY new to
Tkinter/GUI programming, so any suggestions would be wonderful. Something I
would like to do eventually is have the 'checkers' defined in a
list/dictionary, and build the GUI elements from the contents of that
list/dictionary. I just haven't gotten that far yet. Also, the program isn't
finished, and if you don't have the software we use installed, it won't work
Thanks in advance for any information you can send.
More information about the Tutor