I had that problem a few days ago about running external python programs, which I know know can be done with
execfile("filename.py")
But I now have a new problem....
Here is my program I am making for myself:
import random
from Tkinter import *
mainWindow = Tk()
strGame=""
def dieSimulator():
number = random.randint(1,6)
if number == 1:
#print "UNO"
strGame = "UNO"
answerLabel.configure(text=strGame)
elif number == 2:
#print "SMASH TV"
strGame = "SMASH TV"
answerLabel.configure(text=strGame)
elif number == 3:
#print "HALO"
strGame = "HALO"
answerLabel.configure(text=strGame)
elif number == 4:
#print "PDZ"
strGame = "PDZ"
answerLabel.configure(text=strGame)
elif number == 5:
#print "COD"
strGame = "COD"
answerLabel.configure(text=strGame)
elif number == 6:
#print "GRAW"
strGame = "GRAW"
answerLabel.configure(text=strGame)
number2 = random.randint(1,2)
restart = dieSimulator
if number2 == 1:
strGame2 = "Approved"
answerLabel2.configure(text=strGame2)
elif number2 == 2:
strGame2 = "Denied"
answerLabel2.configure(text=strGame2)
startButton = Button(mainWindow, text="Start", command=dieSimulator)
startButton.grid(row=0, column=0)
answerLabel = Label(mainWindow, text="Game...")
answerLabel.grid(row=0, column=1)
answerLabel2 = Label(mainWindow, text="Approved/Denied...")
answerLabel2.grid(row=1, column=1)
mainloop()
When I run it, it does exactly what it's supposed to do, however I would like it to make a new choice if
strGame2 = "Denied"
And I would like for there to be a half second delay when it shows the game, as if it were taking to decide the game, and then taking another half second to decide if it's approved or not.
Another thing I would like, but can't figure out either, is I want to start button's text to change to "Restart" from "Start" once it's been pressed once.
Thanks for your time and help guys...