-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path58_Tkinter_Label.py
More file actions
44 lines (35 loc) · 1.19 KB
/
Copy path58_Tkinter_Label.py
File metadata and controls
44 lines (35 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import tkinter as tk
from tkinter import *
# import tkinter
# from tkinter.constants import *
# tk = tkinter.Tk()
# frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
# frame.pack(fill=BOTH,expand=1)
# label = tkinter.Label(frame, text="Hello, World")
# label.pack(fill=X, expand=1)
# button = tkinter.Button(frame,text="Exit",command=tk.destroy)
# button.pack(side=BOTTOM)
# tk.mainloop()
# root = tk.Tk() # Create a main window
# root.title("My App") # Title of the window
# root.geometry("300x200") # Set size: width x height
# root.mainloop() # Display the window
# label = tk.Label(root, text="Hello, Babu!")
# label.pack()
root = tk.Tk()
root.title("Tkinter Label Example")
root.geometry("800x500")
label = tk.Label(root, text="Hello, Babu!")
label.pack()
def click_me():
print("Button clicked!")
label = tk.Label(root, text="Hello, Babu!")
label.pack()
canvas = tk.Canvas(root, width=1000, height=1000)
canvas.pack()
canvas.create_rectangle(50, 20, 150, 100, fill="red")
# canvas.create_rectangle(250, 200, 150, 100, fill="red")
canvas.create_oval(255, 20, 150, 100,fill="green")
btn = tk.Button(root, text="Click Me", command=click_me)
btn.pack()
root.mainloop()