Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions buttons.py
Original file line number Diff line number Diff line change
@@ -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()
3 changes: 2 additions & 1 deletion center.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,4 +21,4 @@
my_label = Label(root, text=f'Width:{screen_width} Height:{screen_height}')
my_label.pack(pady=20)

root.mainloop()
root.mainloop()