You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
512 B
25 lines
512 B
from tkinter import *
|
|
def clear_fun(frame):
|
|
for widget in frame.winfo_children():
|
|
print(widget)
|
|
def say_hi():
|
|
print("hello ~ !")
|
|
|
|
|
|
root = Tk()
|
|
|
|
frame1 = Frame(root)
|
|
frame2 = Frame(root)
|
|
root.title("tkinter frame")
|
|
|
|
label = Label(frame1, text="Label", justify=LEFT)
|
|
label.pack(side=LEFT)
|
|
|
|
hi_there = Button(frame2, text="say hi~", command=say_hi)
|
|
hi_there.pack()
|
|
|
|
frame1.pack(padx=1, pady=1)
|
|
frame2.pack(padx=10, pady=10)
|
|
clear_fun(frame1)
|
|
clear_fun(frame2)
|
|
root.mainloop() |