ich versuche ein Script auf meinem Pi laufen zu lassen
[codebox=python file=Unbenannt.txt]from Tkinter import *
import os
def breakout():
if(os == "nt"):
os.system("java -jar data/src/breakout.jar")
def pong():
os.system("java -jar data/src/pong.jar")
def snake():
os.system("java -jar data/src/snake.jar")
def list():
breakout_btn_img.grid_forget()
pong_btn_img.grid_forget()
snake_btn_img.grid_forget()
list_btn.grid_forget()
image_btn.grid(row=0, column=0)
breakout_btn.grid(row=1, column=0)
pong_btn.grid(row=2, column=0)
snake_btn.grid(row=3, column=0)
def image():
breakout_btn.grid_forget()
pong_btn.grid_forget()
snake_btn.grid_forget()
image_btn.grid_forget()
list_btn.grid(row=0, column=0)
breakout_btn_img.grid(row=1, column=0)
pong_btn_img.grid(row=2, column=0)
snake_btn_img.grid(row=3, column=0)
root = Tk()
root.title("TheArcadeMachine")
root.resizable(False, False)
list_btn = Button(root, width=47, command=list, relief=SOLID, borderwidth=1, text="list mode")
breakout_img = PhotoImage(file="data/img/breakout.gif")
breakout_btn_img = Button(root, width=333, height=127, image=breakout_img, command=breakout, relief=FLAT)
breakout.image = breakout_img
pong_img = PhotoImage(file="data/img/pong.gif")
pong_btn_img = Button(root, width=333, height=127, image=pong_img, command=pong, relief=FLAT)
pong.image = pong_img
snake_img = PhotoImage(file="data/img/snake.gif")
snake_btn_img = Button(root, width=333, height=127, image=snake_img, command=snake, relief=FLAT)
snake.image = snake_img
image_btn = Button(root, width=47, command=image, relief=SOLID, borderwidth=1, text="picture mode")
breakout_btn = Button(root, width=47, command=breakout, relief=FLAT, text="Breakout", anchor=W, justify=LEFT)
pong_btn = Button(root, width=47, command=pong, relief=FLAT, text="Pong", anchor=W, justify=LEFT)
snake_btn = Button(root, width=47, command=snake, relief=FLAT, text="Snake", anchor=W, justify=LEFT)
list_btn.grid(row=0, column=0)
breakout_btn_img.grid(row=1, column=0)
pong_btn_img.grid(row=2, column=0)
snake_btn_img.grid(row=3, column=0)
root.mainloop()[/code]
Jedoch bekomme ich den Fehler:
Code: Alles auswählen
Traceback (most recent call last):
File "data/src/main.py", line 31, in <module>
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
