need help using Tkinter
MRAB
python at mrabarnett.plus.com
Tue Jul 28 11:32:45 EDT 2009
Manzur Ahmed wrote:
> i wanted to ask you if one of you could help me to use Tkinter. i'm
> trying to just create a simple GUI for which I have provided the code
> for below.
>
> # Simple GUI
> # Demonstrates creating a window
>
> from Tkinter import *
>
> # create the root window
> root = Tk ()
>
> # modify the window
> root.title("Simple GUI")
> root.geometry("200x100")
>
> # kick off the window's event loop
> root.mainloop()
>
> i saved the file as both simple_gui.py and simple_gui.pyw. when i try to
> run simple_gui.pyw i don't get anything and when i try to run
> simple_gui.py i get the following:
> Traceback (most recent call last):
> File "C:\Python-Study\Chapter10\simple_gui.py", line 4, in <module>
> ImportError: No module named Tkinter
>
> i tried to google search this and there were some threads that were
> saying to install tcl but that does not work. I did check the Lib
> directory under the Python directory and I did not see a Tkinter module
> anywhere which I think is the problem. Do you know how I would go about
> with getting this module and if that is not the problem or if you think
> it might be caused by something else, can you please give me some
> guidance? i even reinstalled python 3.1 which i got from www.python.org
> <http://www.python.org/>. i still do not see the Tkinter module in the
> lib directory. thank you for all your help.
>
There are some differences between Python 3.x and Python 2.x. In Python
3.1 the module is called "tkinter", not "Tkinter" (names are
case-sensitive).
More information about the Python-list
mailing list