2017年10月2日 星期一

TKinter create a button which goes to a web page





from tkinter import *
import webbrowser

url = 'https://thenewboston.com'

def openUrl():
    webbrowser.open(url,2)

root = Tk()
myButton = Button(root, text='go to the new boston', command= openUrl)
myButton.pack()
root.mainloop()

沒有留言:

張貼留言

2026 作業1 MQTT基本觀念

 2026 作業1MQTT基本觀念 作業  參考下面網址 https://alex9ufoexploer.blogspot.com/2025/02/1-mqtt-relay-dht22-mqtt-box-pc-mymqtt.html https://alex9ufoexploer...