0%
简介
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
|
from tkinter import *
def clicked(): print('I was clicked')
top = Tk() btn = Button() btn.pack() btn['text'] = 'Click me!' btn['command'] = clicked btn.config(text='click me second',command=clicked) Button(text='click me too',command=clicked).pack()
Label(text="I'am in the first window!").pack() second = Toplevel() Label(second,text="I'am in the second window!").pack()
for i in range(10): Button(text=i).pack()
mainloop()
|