Tkinter(2)

V

vijayca

my python installation is:Active python 2.5.1
i am using Red Hat Linux
i have the Tkinter module installed but any simple script produces an
error....

script:
from Tkinter import Label
widget = Label(None, text='Hello GUI world!')
widget.pack()
widget.mainloop()


error:
Traceback (most recent call last):
File "guy.py", line 2, in <module>
widget = Label(None, text='Hello GUI world!')
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 2464, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1923, in __init__
BaseWidget._setup(self, master, cnf)
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1898, in _setup
_default_root = Tk()
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1636, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment
variable


please help me....
i hate those error messages...
vijay
 
Z

Zentrader

my python installation is:Active python 2.5.1
i am using Red Hat Linux
i have the Tkinter module installed but any simple script produces an
error....

script:
from Tkinter import Label
widget = Label(None, text='Hello GUI world!')
widget.pack()
widget.mainloop()

error:
Traceback (most recent call last):
File "guy.py", line 2, in <module>
widget = Label(None, text='Hello GUI world!')
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 2464, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1923, in __init__
BaseWidget._setup(self, master, cnf)
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1898, in _setup
_default_root = Tk()
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1636, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment
variable

please help me....
i hate those error messages...
vijay

See this example
http://www.pythonware.com/library/tkinter/introduction/hello-tkinter.htm#AEN50
http://www.python-eggs.org/?row=2
 
E

Eric Brunel

my python installation is:Active python 2.5.1
i am using Red Hat Linux
i have the Tkinter module installed but any simple script produces an
error....

script:
from Tkinter import Label
widget = Label(None, text='Hello GUI world!')
widget.pack()
widget.mainloop()


error:
Traceback (most recent call last):
File "guy.py", line 2, in <module>
widget = Label(None, text='Hello GUI world!')
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 2464, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1923, in __init__
BaseWidget._setup(self, master, cnf)
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1898, in _setup
_default_root = Tk()
File "/root/Desktop/pythonall/ActivePython-2.5.1.1-linux-x86/
INSTALLDIR/lib/python2.5/lib-tk/Tkinter.py", line 1636, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment
variable

Basically, this error has nothing to do with Python or Tkinter. If you
tried to launch any GUI application, you should get the same error.

How are you logged in to your computer? Did you do any remote connection
via telnet, or rlogin/rsh, or ssh? This error usually happens when you're
logged in on a remote machine, and you didn't tell the remote machine
where you wanted to display the windows you open. It may also happen when
you're logged in as a user, but did a 'su' to change your identity.

In any case, solving the problem is quite easy: define the DISPLAY
environment variable with the value <your computer name or IP address>:0
and it should work. If you're using a remote machine, you may also have to
issue a 'xhost + <remote machine name or IP address>' on the local machine
(the one where the display should occur).

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top