Oct-29-2020, 11:57 PM
It's dialog from the main app. On click this one popup. Altought I know the basics to create window, I have still trouble when there is class involved, like in this case. I'm not sure where the geometry should be inside the class, before the class or bottom like I did in the post.
(Oct-29-2020, 11:40 PM)deanhystad Wrote: Are you sure this ever worked? AppEmp is not any kind of window, but you pass it as the parent to a frame (as self).
I am not sure how you go about fixing this. Is AddEmp a frame? Is it a dialog? I am going to make it a frame.
from tkinter import * from tkinter import Tk class AddEmp(Frame): # Need some kind of frame or window as superclass def __init__(self, *args, **kvargs): super().__init__(*args, **kvargs) # Initialize superclass self.pack(fill='both', expand=True) # Pack self in parent # Now you can add widgets to self because self is a frame. self.header_lbl = Label(self, text='Label 1') self.header_lbl.grid(row = 0, column = 0, padx = 15, pady = 15) self.header_introduction = Label(self, text = 'Label 2') self.header_introduction.grid(row = 1, column = 0) root = Tk() AddEmp(root) root.title('All Fields are required') root.geometry('100x100') root.mainloop()