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 ) root . mainloop ( )

测试输出结果如下:

Python GUI编程 Python GUI编程