2017年10月4日 星期三

Hello, Again




hi there, everyone!
>>> 

If you click the right button, the text “hi there, everyone!” is printed to the console. 

If you click the left button, the program stops.
#===============================================
#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 *

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.button = Button(
            frame, text="QUIT", fg="red", command=frame.quit
            )
        self.button.pack(side=LEFT)

        self.hi_there = Button(frame, text="Hello", command=self.say_hi)
        self.hi_there.pack(side=LEFT)

    def say_hi(self):
        print ("hi there, everyone!")

root = Tk()

app = App(root)

root.mainloop()

root.destroy() # optional; see description below

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) 3) 使用database需先create建立資料庫 Node-Red 程式 [...