I have installed the WebIDE on Occidentalis v0.2 on my Raspberry Pi. Everything seems to be working fine (nice tutorials!).
However, I'm trying to run the simple program below using the Tkinter GUI libraries:
- Code: Select all
# File: hello1.py
from Tkinter import *
# Create root window
root = Tk()
root.title("My First Raspberry Pi GUI")
root.geometry("200x85")
# Create a frame
app = Frame(root)
app.grid()
# Create a button in the frame
bttn1 = Button(app, text = "Click me!")
bttn1.grid()
# Start main loop
root.mainloop()
And, I receive the following error when I run it:
- Code: Select all
webide@raspberrypi /usr/share/adafruit/webide/repositories/my-pi-projects/Hello_World $ sudo python hello1.py
Traceback (most recent call last):
File "hello1.py", line 7, in <module>
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1688, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
I have tried to manually set the $DISPLAY environment variable to the LXDE session running off the HDMI port on the Raspberry PI itself whose $DISPLAY environment variable I confirmed is ':0.0' but had no luck.
Any ideas? Is Occidentalis and the WebIDE incompatible with Tkinter?
P. Todd

