from tkinter import *
class page:
def pageNext(self, pageNext):
self.pageNext = pageNext
pageNext.tkraise()
def button(self, window, text, x, y, command = None):
self.window = window
self.text = text
self.x = x
self.y = y
self.command = command
button = Button(window, text = text, command = lambda:command)
button.place(x = x, y = y)
def label(self, window, text, x, y, header = False):
self.window = window
self.text = text
self.x = x
self.y = y
self.header = header
if header == True:
label = Label(window, font = "Helvetica 16 bold italic", text = text)
else:
label = Label(window, text = text)
label.place(x = x, y = y)
def newPage(self, window):
self.window = window
pageNew = Frame(window)
pageNew.grid(row = 0, column = 0, sticky = "News")
return pageNew
root = Tk()
page = page()
Guys when I try to create a frame using pageWelcome = page.newPage(root)
and place a button using page.button(pageWelcome)
and say page.pageNext(pageWelcome)
it doesn't place the button but when I place a button like page.button(root)
it places the button to the screen. I can't see which part of my code is broken. Can someone help?
P.S: I made this class basing to my first GUI. In that times i couldn't use classes but my code was working fine.