OOP in Python - Inheritance
OOP in Python - Inheritance
self.title('Main Window')
Button(self,
text='Open a window',
command=self.open_window).pack(expand=Tr
ue)
def open_window(self):
window = Window(self)
window.grab_set()
class Window(Toplevel):
super().__init__(parent)
self.geometry('300x100')
self.title('Toplevel Window')
Button(self,
text='Close',
command=self.destroy).pack(expand=True)
if __name__ == "__main__":
app = App()
app.mainloop()