Python PYQT 控制項基本使用

2022-07-01 14:57:14 字數 4893 閱讀 8512

qtgui.qcombobox控制項常用函式:

.additem(string)

#新增字串項到item

.additems(list)

#新增列表或元組元素到item

.clear()

#清除所有item

.clearedittext()

#清除編輯框內容

.count()

#返回item數目

.currentindex()

#返回當前選擇索引,從0開始

.currenttext()

#返回當前選擇內容

.insertitem(index,string)

#插入字串項到item項index後

.insertitems(index,list)

#插入列表或元組元素到item項index後

.insertseparator(index)

#插入分隔符到item項index後

.itemtext(index)

#返回item項index的內容

.removeitem(index)

#刪除item項index

.setcurrentindex(index)

#設定item項index為當前選擇

.seteditable(true)

#設定選框可編輯

.setedittext(string)

#設定編輯框內容

.setitemtext(index,string)

#設定item項index內容為字串值

qtgui.qlineedit控制項常用函式:

.backspace()#

模擬backspace退格鍵

.clear()

#清除輸入框內容

.cursorposition()

#返回輸入框游標位置,從0開始

.setechomode(echomode)

#設定輸入框顯示格式

#0--normal,1--noecho,2--password,3--passwordechoonedit

.setplaceholdertext(string)

#設定輸入框浮顯文字

.setreadonly(true)

#設定輸入框唯讀

.settext(string)

#設定輸入框內容

.text()

#返回輸入框內容

qtgui.qspinbox控制項常用函式:

.setmaximum(max)

#設定最大值

.setminimum(min)

#設定最小值

.setrange(min,max)

#設定範圍

.setsinglestep(step)

#設定步長

.setvalue(num)

#設定輸入框當前值

.value()

#返回輸入框當前值

qtgui.qlabel控制項常用函式:

.clear()

#清除標籤內容

.setpixmap(qtgui.qpixmap(path))

#設定標籤內容

.settext(string)

#設定標籤內容文字

.text()

#返回標籤內容

qtgui.qlistwidget控制項常用函式:

.additem(string)

#新增字串項到item

.additems(list)

#新增列表或元組元素到item

.clear()

#清除所有item

.count()

#返回item數目

.currentitem()

#返回當前選擇item類,沒選返回none

.currentrow()

#返回當前選擇索引行,從0開始,沒選返回-1

.insertitem(row,string)

#插入字串項到item項row行後

.insertitems(row,list)

#插入列表或元組元素到item項row行後

.item(row)

#返回item項row行的item類

.setcurrentitem(item)

#設定item項item為當前選擇

.setcurrentrow(row)

#設定item項row行為當前選擇

item類方法:

.text()

#返回內容

.settext()

#設定內容

posted on 2019-05-08 10:12

收藏qtgui.qcombobox控制項常用函式:

.additem(string)

#新增字串項到item

.additems(list)

#新增列表或元組元素到item

.clear()

#清除所有item

.clearedittext()

#清除編輯框內容

.count()

#返回item數目

.currentindex()

#返回當前選擇索引,從0開始

.currenttext()

#返回當前選擇內容

.insertitem(index,string)

#插入字串項到item項index後

.insertitems(index,list)

#插入列表或元組元素到item項index後

.insertseparator(index)

#插入分隔符到item項index後

.itemtext(index)

#返回item項index的內容

.removeitem(index)

#刪除item項index

.setcurrentindex(index)

#設定item項index為當前選擇

.seteditable(true)

#設定選框可編輯

.setedittext(string)

#設定編輯框內容

.setitemtext(index,string)

#設定item項index內容為字串值

qtgui.qlineedit控制項常用函式:

.backspace()#

模擬backspace退格鍵

.clear()

#清除輸入框內容

.cursorposition()

#返回輸入框游標位置,從0開始

.setechomode(echomode)

#設定輸入框顯示格式

#0--normal,1--noecho,2--password,3--passwordechoonedit

.setplaceholdertext(string)

#設定輸入框浮顯文字

.setreadonly(true)

#設定輸入框唯讀

.settext(string)

#設定輸入框內容

.text()

#返回輸入框內容

qtgui.qspinbox控制項常用函式:

.setmaximum(max)

#設定最大值

.setminimum(min)

#設定最小值

.setrange(min,max)

#設定範圍

.setsinglestep(step)

#設定步長

.setvalue(num)

#設定輸入框當前值

.value()

#返回輸入框當前值

qtgui.qlabel控制項常用函式:

.clear()

#清除標籤內容

.setpixmap(qtgui.qpixmap(path))

#設定標籤內容

.settext(string)

#設定標籤內容文字

.text()

#返回標籤內容

qtgui.qlistwidget控制項常用函式:

.additem(string)

#新增字串項到item

.additems(list)

#新增列表或元組元素到item

.clear()

#清除所有item

.count()

#返回item數目

.currentitem()

#返回當前選擇item類,沒選返回none

.currentrow()

#返回當前選擇索引行,從0開始,沒選返回-1

.insertitem(row,string)

#插入字串項到item項row行後

.insertitems(row,list)

#插入列表或元組元素到item項row行後

.item(row)

#返回item項row行的item類

.setcurrentitem(item)

#設定item項item為當前選擇

.setcurrentrow(row)

#設定item項row行為當前選擇

item類方法:

.text()

#返回內容

.settext()

#設定內容

python PyQt5 基本結構

0.匯入需要的包和模組 from pyqt5.qt import 主要包含了我們常用的一些類,彙總到了一塊 import sys 1.建立乙個應用程式物件 2.控制項的操作 建立控制項,設定控制項 大小,位置,樣式.事件,訊號的處理 2.1 建立控制項 當我們建立乙個控制項之後,如果說,這個控制項沒...

Javascript cssText基本使用指北

一 csstext之起步 那些年,我們是這樣設定樣式的 style.width 233px style.position fixed style.left 233px 現如今,我們可以這樣搞 style.csstext width 233px height 233px position fixed ...

ios NSUserDefaults基本使用

nsuserdefaults適合儲存輕量級的本地資料儲存,比如儲存登陸介面的使用者名稱 密碼之類的資料,並使之本地持久化。nsuserdefaults支援的資料格式有 nsnumber integer float double nsstring,nsdate,nsarray,nsdictionary...