[英]In Python, is there a way to detect the use of incorrect variable names; something like VB's “Option Explicit”?
[英]Is there a way to set to Combo element(PySimpleGuiQt's) with text and value to each option? (Something like HTML's option list)
[sg.Combo(someListOfNames, someListOfObjects)]
如果我調用values[0]
,我將只獲得someListOfNames
的選擇索引值,我想獲得someListOfObjects
與用戶在 GUI 上選擇的索引相同的someListOfNames
索引的值。
我嘗試以不同的方式設置它,例如:
[sg.Combo(someListOfNames, values=someListOfObjects)]
(返回TypeError: Combo.__init___() got multiple values for argument 'values'
我還嘗試了在 Combo 的 class 或文檔中找到的default-value
和其他 var 名稱,但似乎都沒有。
僅使用Combo
someListOfNames
中的 someListOfNames,然后使用index
function 找到它的索引,並從someListOfObjects
中獲取 object
[sg.Combo(someListOfNames)]
selectedObjectByName = someListOfObjects[(someListOfNames.index(values[0]))]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.