Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/env python3
- import tkinter as tk # python3
- from tkinter import BooleanVar
- TITLE_FONT = ("Helvetica", 18, "bold")
- class SampleApp(tk.Tk):
- def __init__(self, *args, **kwargs):
- tk.Tk.__init__(self, *args, **kwargs)
- container = tk.Frame(self)
- container.pack(side="top", fill="both", expand=True)
- container.grid_rowconfigure(0, weight=1)
- container.grid_columnconfigure(0, weight=1)
- self.Page1_data={"Step1Complete": BooleanVar()}
- self.frames = {}
- for F in (StartPage, PageFifteen):
- page_name = F.__name__
- frame = F(container, self)
- self.frames[page_name] = frame
- frame.grid(row=0, column=0, sticky="nsew")
- self.show_frame("StartPage")
- def show_frame(self, page_name):
- frame = self.frames[page_name]
- frame.tkraise()
- class StartPage(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.controller = controller
- controller.title("Part B Data Collection")
- controller.geometry("600x500")
- label = tk.Label(self, text="Welcome to the Part B Test!", font=TITLE_FONT)
- label.pack(side="top", fill="x", pady=10)
- button1 = tk.Button(self, text="Complete Step 1", command=self.MakeStep1Complete)
- button1.place(relx=0.385, rely=0.65)
- def MakeStep1Complete(self):
- Step1Complete=True
- self.controller.Page1_data["Step1Complete"]=Step1Complete
- self.controller.show_frame("PageFifteen")
- class PageFifteen(tk.Frame):
- def StatusCheck(self):
- Step1Complete=self.controller.Page1_data["Step1Complete"]
- print("True or false: at Step 15, Step 1 completed -a ")
- print(Step1Complete)
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.controller = controller
- label = tk.Label(self, text="Check the data", font=TITLE_FONT)
- label.pack(side="top", fill="x", pady=10)
- self.StatusCheck()
- tk.Label(self, text="Click on each of the buttons below to review the data you have inputted").place(relx=0.15, rely=0.12)
- Step1Complete=self.controller.Page1_data["Step1Complete"].get()
- print("True or false: at Step 15, Step 1 completed - b")
- print(Step1Complete)
- button17=tk.Button(self, text="Check if we did everything",
- command=self.StatusCheck)
- button17.place(relx=0.7, rely=0.75)
- if __name__ == "__main__":
- app = SampleApp()
- app.mainloop()
- True or false: at Step 15, Step 1 completed -a
- PY_VAR1045
- True or false: at Step 15, Step 1 completed - b
- False
- True or false: at Step 15, Step 1 completed -a
- True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement