Reputation: 301
I am trying to create a login system in Python. I was able to create the window but the button does not appear therein. Can someone please help me? Here the code:
from tkinter import *
class Window(Frame):
def __init__(self, master = None):
Frame.__init__(self, master)
self.master.title("Login")
self.pack(fill = BOTH, expand = 1)
self.master = master
def init_window(self):
self.master.title("Register")
self.pack(fill= BOTH, expand= 1)
registerbutton = Button(self, text= "Register")
registerbutton.place(x = 0, y = 0)
root = Tk()
root.geometry("400x300")
app = Window(root)
root.mainloop()
Upvotes: 0
Views: 42
Reputation: 4225
You need to call init_window()
function, in order to show the button as place
is in that function
app = Window(root)
app.init_window()
root.mainloop()
Upvotes: 2