close

> conda install –c anaconda tk

image

 

   1: import tkinter as tk
   2: win = tk.Tk()
   3: win.mainloop()

image

   1: import tkinter as tk
   2: win = tk.Tk()
   3: win.title('Hello World')
   4: win.mainloop()

image

   1: import tkinter as tk
   2: win=tk.Tk()
   3: win.title("Hello world")
   4: #win.resizable(1,0) # horizontal resizable
   5: #win.resizable(0,1) # verticle resizable
   6: win.geometry('640x480')
   7: win.resizable(0,0)
   8: win.mainloop()
image
   1: import tkinter as tk
   2: win = tk.Tk()
   3: win.title('Tk Win')
   4: label = tk.Label(win, text='Hello World') #建立標籤物件
   5: label.pack()
   6: button=tk.Button(win, text='OK')
   7: button.pack()     #顯示元件
   8: win.mainloop()

image

 

 

參考資料

1. https://anaconda.org/anaconda/tk

2. Python 的內建 GUI 模組 Tkinter 測試 (一) : 建立視窗

3. Graphical User Interfaces with Tk

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 me1237guy 的頭像
    me1237guy

    天天向上

    me1237guy 發表在 痞客邦 留言(0) 人氣()