天天看點

PYQT控件使用

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倒退鍵

#清除輸入框内容

.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

#清除标簽内容

.setpixmap(qtgui.qpixmap(path))

#設定标簽内容圖檔

#設定标簽内容文字

#傳回标簽内容

qtgui.qlistwidget

.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類方法:

#傳回内容

.settext()

#設定内容