Hi I was wondering why my DisplayPage wasn't lifting when the ok button was pressed in MainPage. I've cut off most of my code (to keep it more to the point of the error, so its a bit segmented but basically I'm creating 2 frames (MainPage and DisplayPage) and want to basically let the user input data into MainPage and then press the next button to show/output the input data in DisplayPage.
Here's a section of the code that's creating the unexpected result.
from Tkinter import *
import Tkinter as tk
import os
class page(tk.Frame):
def __init__(self, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
def show(self):
self.lift()
class DisplayPage(page):
def __init__(self, *args, **kwargs):
page.__init__(self, *args, **kwargs)
# deleted - however will upload if needed more information about my code
class MainPage(tk.Frame):
def __init__(self, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
p1 = DisplayPage(self)
# create all of the main containers
frame_A = Frame(self, width=930, height=780)
frame_B = Frame(self, width=465, height=280)
frame_C = Frame(self, width=465, height=280)
frame_D = Frame(self, width=465, height=140)
frame_E = Frame(self, width=465, height=70)
# layout all of the main containers
frame_A.grid(row=0, column=0, columnspan=2, rowspan=3)
frame_B.grid(row=0, column=3)
frame_C.grid(row=1, column=3)
frame_D.grid(row=2, column=3)
frame_E.grid(row=3, column=3)
# next ok button
content4= Frame(frame_E)
ok = tk.Button(content4, text="Locate", font =('Roboto Thin', 30), command= p1.lift)
ok.pack()
# layout all widgets
content1.grid(column=0, row=0)
content2.grid(column=3, row=1)
content3.grid(column=3, row=2)
content4.grid(column=3, row=3)
namelbl.grid(column=3, row=1)
name.grid(column=3, row=6)
namelbl2.grid(column=3, row=5)
name2.grid(column=3, row=8)
namelbl3.grid(column=3, row=7)
name3.grid(column=3, row=10)
one.grid(column=3, row=2)
two.grid(column=3, row=3)
three.grid(column=3, row=4)
ok.grid(column=3, row=11)
namelbl4.grid(column=3, row=9)
p1.show()
if __name__ == "__main__":
root = tk.Tk()
main = MainPage(root)
main.pack(side="top", fill="both", expand=True)
root.wm_title('MobilePark Simulator')
root.wm_geometry("1300x830")
root.mainloop()