亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Python tkinter之ComboBox(下拉框)的使用簡(jiǎn)介

瀏覽:122日期:2022-06-28 11:03:47
1、ComboBox的基礎(chǔ)屬性

# -*- encoding=utf-8 -*-import tkinterfrom tkinter import *from tkinter import ttkif __name__ == ’__main__’: win = tkinter.Tk() # 窗口 win.title(’南風(fēng)丶輕語(yǔ)’) # 標(biāo)題 screenwidth = win.winfo_screenwidth() # 屏幕寬度 screenheight = win.winfo_screenheight() # 屏幕高度 width = 600 height = 500 x = int((screenwidth - width) / 2) y = int((screenheight - height) / 2) win.geometry(’{}x{}+{}+{}’.format(width, height, x, y)) # 大小以及位置 value = StringVar() value.set(’CCC’) values = [’AAA’, ’BBB’, ’CCC’, ’DDD’] combobox = ttk.Combobox( master=win, # 父容器 height=10, # 高度,下拉顯示的條目數(shù)量 width=20, # 寬度 state=’readonly’, # 設(shè)置狀態(tài) normal(可選可輸入)、readonly(只可選)、 disabled cursor=’arrow’, # 鼠標(biāo)移動(dòng)時(shí)樣式 arrow, circle, cross, plus... font=(’’, 20), # 字體 textvariable=value, # 通過(guò)StringVar設(shè)置可改變的值 values=values, # 設(shè)置下拉框的選項(xiàng) ) print(combobox.keys()) # 可以查看支持的參數(shù) combobox.pack() win.mainloop()

Python tkinter之ComboBox(下拉框)的使用簡(jiǎn)介

2、綁定選中事件

# -*- encoding=utf-8 -*-import tkinterfrom tkinter import *from tkinter import ttkdef choose(event): # 選中事件 print(’選中的數(shù)據(jù):{}’.format(combobox.get())) print(’value的值:{}’.format(value.get()))if __name__ == ’__main__’: win = tkinter.Tk() # 窗口 win.title(’南風(fēng)丶輕語(yǔ)’) # 標(biāo)題 screenwidth = win.winfo_screenwidth() # 屏幕寬度 screenheight = win.winfo_screenheight() # 屏幕高度 width = 600 height = 500 x = int((screenwidth - width) / 2) y = int((screenheight - height) / 2) win.geometry(’{}x{}+{}+{}’.format(width, height, x, y)) # 大小以及位置 value = StringVar() value.set(’CCC’) # 默認(rèn)選中CCC==combobox.current(2) values = [’AAA’, ’BBB’, ’CCC’, ’DDD’] combobox = ttk.Combobox( master=win, # 父容器 height=10, # 高度,下拉顯示的條目數(shù)量 width=20, # 寬度 state=’normal’, # 設(shè)置狀態(tài) normal(可選可輸入)、readonly(只可選)、 disabled cursor=’arrow’, # 鼠標(biāo)移動(dòng)時(shí)樣式 arrow, circle, cross, plus... font=(’’, 20), # 字體 textvariable=value, # 通過(guò)StringVar設(shè)置可改變的值 values=values, # 設(shè)置下拉框的選項(xiàng) ) combobox.bind(’<<ComboboxSelected>>’, choose) print(combobox.keys()) # 可以查看支持的參數(shù) combobox.pack() win.mainloop()

Python tkinter之ComboBox(下拉框)的使用簡(jiǎn)介

以上就是Python tkinter之ComboBox(下拉框)的使用簡(jiǎn)介的詳細(xì)內(nèi)容,更多關(guān)于Python tkinter之ComboBox 下拉框的使用的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 国内精品综合九九久久精品 | 99亚洲乱人伦精品 | 免费色片 | 国产91精品在线播放 | 成人午夜小视频 | 最新国产精品精品视频 | 欧美黄色录像 | 国产亚洲精品久久麻豆 | 国产大秀视频在线一区二区 | 麻豆网站免费观看 | 91国内外精品自在线播放 | maomiav在线| 国产一级精品高清一级毛片 | 成人视品 | 亚洲性色综合图区图片 | 精精国产www视频在线观看免费 | 色婷婷六月丁香在线观看 | 国产小视频91 | 95视频在线播放 | 99久在线精品99re6视频 | 男人午夜免费视频 | 妞干网在线免费观看 | 久久观看午夜精品 | 午夜精品成人毛片 | 欧美亚洲国产色综合 | 91免费视频版 | 日本免费人成黄页网观看视频 | 中文字幕一区二区三区四区 | 欧美国产亚洲精品高清不卡 | 国产女人综合久久精品视 | 亚洲综合套图 | 黄色三及 | 337p粉嫩大胆噜噜噜鲁 | 久久国产免费福利永久 | 播放一级黄色片 | 欧美高清免费一级在线 | 美国aaaa一级毛片啊 | 久久综合精品国产一区二区三区无 | 亚洲狠狠狠一区二区三区 | 一级毛片特级毛片国产 | 国产毛片a级 |