Red Hat Bugzilla – Bug 7379
Python needs DISPLAY environment var set b/4 tkinter works
Last modified: 2008-05-01 11:37:53 EDT
When I attempt to do a simple Hello World type example of using python and
tkinter (from the "Learning Python" book), I get an abort due to "no
display name or DISPLAY environment varible not set". Since there's
nothing in the Python book, or on any tkinter web page I could find, about
this DISPLAY variable, it seems that it should be a standard assignment of
some sort. What is missing from my configuration?
>>> from tkinter import *
>>> w = Button(text="Hello World!", command='exit')
It's a variable that's set automatically if you're running in an xterm window,
and the usual reason for it not being set is that you're not running in an xterm
window. Are you?
tkinter only runs under X. If DISPLAY isn't set, it's because you
aren't running X. Run X. The manual explains how to do that.