Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as Tkinter
- import sys
- root = Tkinter.Tk()
- root.title("Munchkin")
- def buttonTest():
- print("Starting game...")
- showHand = Tkinter.Button(text="Show hand", fg="green", pady=2, bd=3)
- showLocalTable = Tkinter.Button(text="Show your table", fg="green", pady=2, bd=3)
- countHand = Tkinter.Button(text="Count hand", fg="blue",pady=2, bd=3)
- quitGame = Tkinter.Button(text="Quit", bg="red")
- startGame = Tkinter.Button(text="Start Game", bg="green", padx=10, pady=5, bd=3, command=buttonTest)
- showHand.grid(row=2, column =0)
- showLocalTable.grid(row=3, column =0)
- countHand.grid(row=4, column =0)
- quitGame.grid(row=6, column =0)
- startGame.grid(row=5, column =0)
- label1 = Tkinter.Label(root, text="Command box")
- entry1 = Tkinter.Entry(root, width=100) #possibly move these into the gui section for the term
- label1.grid(row=7)
- entry1.grid(row=8) #possibly move these into the gui section for the term
- Tkinter.messagebox.showinfo("Munchkin", "Welcome to Munchkin!\n\nGo down into the dungeon, kill everything you meet.\nYou can backstab your friends, or help them. Or both!\nWhoever scrambles to level 10 first gets the treasure.\n\nFull rules at en.wikipedia.org/wiki/Munchkin_(card_game) ")
- #shellAdder(root)
- class shellOutputRedirect():
- def __init__(self, text_widget):
- self.text_space = text_widget
- def write(self, string):
- self.text_space.config(state=Tkinter.NORMAL)
- self.text_space.insert("end", string)
- self.text_space.see("end")
- self.text_space.config(state=Tkinter.DISABLED)
- class shellAdder():
- def __init__(self, parent):
- text_box = Tkinter.Text(parent, state=Tkinter.DISABLED)
- text_box.grid(row=0)
- sys.stdout = shellOutputRedirect(text_box)
- sys.stderr = shellOutputRedirect(text_box)
- output_button = Tkinter.Button(parent, text="Send command", command=self.getEntry, pady=5, padx=5)
- output_button.grid(row=15, column=0)
- def getEntry(self):
- self.text_space.insert("end", string)
- #print ("Std Output")
- #input()
- #raise ValueError("Std Error")
- shellAdder(root)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement