真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

tkinter學(xué)習(xí)_radiobutton

#encoding=utf-8
import tkinter as tk
window = tk.Tk()
window.title("測試單選框")
window.geometry("400x200")

var = tk.StringVar()

label_1 = tk.Label(window,bg="yellow",textvar=var,width=10,height=1,text="label_1")
label_1.pack()

def print_selection():
    #label的config函數(shù)可以改變label對象里定義的參數(shù)的值
    label_1.config(text= "你選擇了選項: " + var.get())
    label_1.config(bg="green")
    label_1.config(width=12)
#定義單選按鈕,var=var,value="A" 指把value的值賦值給var
radiobutton_1 = tk.Radiobutton(window,text="選項A",var=var,value="A",command=print_selection)
radiobutton_1.pack()

radiobutton_2 = tk.Radiobutton(window,text="選項B",var=var,value="B",command=print_selection)
radiobutton_2.pack()

radiobutton_3 = tk.Radiobutton(window,text="選項C",var=var,value="C",command=print_selection)
radiobutton_3.pack()

window.mainloop()

網(wǎng)頁題目:tkinter學(xué)習(xí)_radiobutton
文章來源:http://weahome.cn/article/gjddps.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部