2017年10月2日 星期一

Hello, Tkinter

Hello, Tkinter



#In Python 2, it is called Tkinter, while in Python 3
"""Tkinter module:
       import Tkinter
       Or, more often:
       from Tkinter import *
       
    import Tkinter as Tk """

from tkinter import *

root = Tk()

w = Label(root, text="Hello, world!")
w.pack()

root.mainloop()

=======================


root = Tk()

Next, we create a Label widget as a child to the root window:

w = Label(root, text="Hello, world!")
w.pack()

A Label widget can display either text or an icon or other image. In this case, we use the text option to specify which text to display.

Next, we call the pack method on this widget. This tells it to size itself to fit the given text, and make itself visible. 

However, the window won’t appear until we’ve entered the Tkinter event loop:

root.mainloop()

The program will stay in the event loop until we close the window.

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...