diff --git a/buttons.py b/buttons.py index 9e7cd30..908959d 100644 --- a/buttons.py +++ b/buttons.py @@ -1,15 +1,19 @@ from tkinter import * -root = Tk() -def myClick(): - myLabel = Label(root, text="Look! I clicked a Button!!") - myLabel.pack() - -myButton = Button(root, text="Click Me!", command=myClick) -myButton.pack() - - - -root.mainloop() +class Button(TK): + super().__init__() + self.geometry("800x400") + + def myClick(): + self.myLabel = Label(self, text="Look! I clicked a Button!!") + self.myLabel.pack() + def create_button(): + self.btn = Button(self, text="Click Me!", command=myClick) + def run(): + self.mainloop() + +b = Button() +b.create_button() +b.run() diff --git a/center.py b/center.py index 2d1ba42..0c26433 100644 --- a/center.py +++ b/center.py @@ -3,6 +3,7 @@ root = Tk() root.title('Codemy.com - Center') root.iconbitmap('c:/gui/codemy.ico') +root.geometry("800x500") # Designate Height and Width of our app app_width = 500 @@ -20,4 +21,4 @@ my_label = Label(root, text=f'Width:{screen_width} Height:{screen_height}') my_label.pack(pady=20) -root.mainloop() \ No newline at end of file +root.mainloop()