[Tutor] Problem with modules

Richard Seguin rseguin@shaw.ca
Mon, 05 Aug 2002 13:57:59 -0400


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am trying to create a program that is very modular and seem to be having 
problems with def calls. 

Example I have a module called gui.py that only creates the GUI interface 
(using Tkinter)...

gui.py -----------------------------

 menubar = Menu(main_window)

   # Create File Menu
   # --------------------
   filemenu = Menu(menubar, tearoff=0)
   filemenu.add_command(label="Option 1",command="TEST")  
   filemenu.add_command(label="Option 2",command="")
   filemenu.add_command(label="Option 3",command="")
   filemenu.add_separator()
   filemenu.add_command(label="Exit",command="exit")
   menubar.add_cascade(label="File", menu=filemenu)

- ---------SNIP -----------------


main.py ----------------------------
from gui import *

def TEST():
   print "Option 1"

gui()

================================================================

When you call the function gui() you would expect that the function TEST() 
would be known to gui.py wouldn't you? This may be a newbie question but the 
answer for this should put everything into perspective. 

Richard

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9Tryrn9670YZTFEcRAmDOAJ4wKzpz/Zjkk3Pu4t56pN1mRi1DNQCeLYkC
LFo69qh3fy/xgwoTTPLht4Q=
=86TH
-----END PGP SIGNATURE-----