Hey!
I'm having serious problems using tkInter. Everything went fine when I was still using the pack method. Now, after I have switched to the grid method, a problem has come up. No matter what I try, the whole script is executed at once. And I don't want that.
The idea is that you select some options in step one, click continue, and step two pops up. No matter what I try, step two immediatly pops up at startup.
Here's my script:
What I have tried: pass the profpick int to the cont function, and check if it is not 0. However, no matter what I tried, nothing happened.
I hope somebody can help me!
I'm having serious problems using tkInter. Everything went fine when I was still using the pack method. Now, after I have switched to the grid method, a problem has come up. No matter what I try, the whole script is executed at once. And I don't want that.
The idea is that you select some options in step one, click continue, and step two pops up. No matter what I try, step two immediatly pops up at startup.
Here's my script:
Code:
import random
from Tkinter import *
class Startup:
def __init__(self, master):
frame = Frame(master,bg="Gray")
frame.pack()
self.root = master
self.master = master
self.stepo = Label(frame,text="Step 1.",font=(15),bg="Gray",relief=RAISED,bd=3,fg="Red")
self.stepo.grid(row=1,column=2)
self.setuplab = Label(frame,text="Setup players and games",font=(15),relief=GROOVE,bd=1,justify=LEFT,bg="Gray")
self.setuplab.grid(row=3,column=1)
self.playslide = Scale(frame, from_=2, to=10, orient=HORIZONTAL,bg="Gray",troughcolor="Gray")
self.playslide.grid(row=7,column=1)
self.playlab = Label(frame,text="Players.",bg="Gray")
self.playlab.grid(row=8,column=1)
self.egames = Entry(frame)
self.egames.grid(row=5,column=1)
self.gamelab = Label(frame,text="Games.",bg="Gray")
self.gamelab.grid(row=6,column=1)
self.setuplab = Label(frame,text="Setup profiles select type",font=(15),relief=GROOVE,bd=1,justify=LEFT,bg="Gray")
self.setuplab.grid(row=3,column=3)
profpick = 0
self.rad1 = Radiobutton(frame, text="Randomly", variable=profpick, value=1,bg="Gray",highlightcolor="Gray")
self.rad1.grid(row=4,column=3)
self.rad2 = Radiobutton(frame, text="Manual", variable=profpick, value=2,bg="Gray",highlightcolor="Gray")
self.rad2.grid(row=5,column=3)
self.rad3 = Radiobutton(frame, text="Standard set", variable=profpick, value=3,bg="Gray",highlightcolor="Gray")
self.rad3.grid(row=6,column=3)
self.steptwo = Button(frame,text="Go to step 2",command=self.cont(),bg="Gray")
self.steptwo.grid(row=10,column=2)
def cont(self):
games = self.egames.get()
players = self.playslide.get()
app = StepT(root)
class StepT():
def __init__ (self,master):
frame = Frame(master,bg="Gray")
frame.pack()
self.stepi = Label(frame,text="Step 2.",font=(15),bg="Gray",relief=RAISED,bd=3,fg="Red")
self.stepi.grid(row=11,column=2)
root = Tk()
app = Startup(root)
app.master.title("Dis Astro's Poker Simulator")
root.mainloop()
What I have tried: pass the profpick int to the cont function, and check if it is not 0. However, no matter what I tried, nothing happened.
I hope somebody can help me!