I am new to Python. I tried to run the following program using IDLE for Python 2.4 and it worked fine:
from Tkinter import *
class GUIFramework(Frame):
"""This is the GUI"""
def __init__(self,master=None):
"""Initialize"""
"""Initialize the base class"""
Frame.__init__(self,master)
"""Display the main window"""
self.grid()
"""Create the Text"""
self.HelloLabel = Label(master, text="Hello World!")
self.HelloLabel.grid()
if __name__ == "__main__":
guiFrame = GUIFramework()
guiFrame.mainloop()
"""This is the GUI"""
def __init__(self,master=None):
"""Initialize"""
"""Initialize the base class"""
Frame.__init__(self,master)
"""Display the main window"""
self.grid()
"""Create the Text"""
self.HelloLabel = Label(master, text="Hello World!")
self.HelloLabel.grid()
if __name__ == "__main__":
guiFrame = GUIFramework()
guiFrame.mainloop()
When I tried to run this program from the DOS window with the command:
python gui1.py
I received the following error:
F:\temp\Python Test Folder>python gui1.py
Traceback (most recent call last):
File "gui1.py", line 1, in ?
from Tkinter import *
File "c:\Program Files\Python24\lib\lib-tk\Tkinter.py", line 2, in ?
Traceback (most recent call last):
File "gui1.py", line 1, in ?
from Tkinter import *
File "c:\Program Files\Python24\lib\lib-tk\Tkinter.py", line 2, in ?
AttributeError: 'module' object has no attribute 'Label'
F:\temp\Python Test Folder>
Can someone tell me what is wrong?
In addition, how can I get the program to run under IDLE and have the main window maximized on display without having to click on the Maximize box myself?
Call friends with PC calling -- FREE
_______________________________________________ IDLE-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/idle-dev
