[問題] 為什麼有動作,但還是空白

作者: euser1777 (YY)   2022-02-01 18:06:22
以下附上我的code
https://gist.github.com/cj044/279f792a216ee82b25d47cfd28fdda88
還有CSV 檔案
https://gist.github.com/cj044/8bb2ece639dae63fc59fa9dcce4e1716
https://github.com/cj044/VIP-HW (UI檔案)
Q1:
比較有問題的是 47 ~ 60
def All_class(self): #讀取全部的學生名單,存在列表裡
.....................
self.ui.listView1.setModel(qlist)
每次build
https://imgur.com/U3QMTlr
Q2:
再來debug的時候 看到 https://imgur.com/1WvkoK7
實在看不懂橘色框框的東西 self : < __main ___
這樣無助於我解bug
Q3:
Gituub All gists 的兩個檔案
https://gist.github.com/cj044/279f792a216ee82b25d47cfd28fdda88
還有CSV 檔案
https://gist.github.com/cj044/8bb2ece639dae63fc59fa9dcce4e1716
該如何跟
https://github.com/cj044/VIP-HW
放在同一個資料檔?
解了三天,google python qlist = QStringListModel() 還是無解?
只得到這個 https://its401.com/article/LaoYuanPython/104050416
謝謝!
作者: lycantrope (阿寬)   2022-02-01 20:18:00
54行 必須是self.class_info.extend(row)你也搞錯append的用法
作者: ddavid (謊言接線生)   2022-02-02 04:16:00
Google list.append 跟 list.extend 就有了啊?不然就直接看官方文件裡面 list 的部份啊要更明顯兩者比較的文章也很容易找啊,例如:https://bit.ly/3GjtpNR
作者: leolarrel (真.粽子無雙)   2022-02-02 10:41:00
你還在五年前那家公司嗎?
作者: lycantrope (阿寬)   2022-02-02 10:52:00
問題是Qstringlist只讀List[str] 但在row in rows 的loop中 row是list[str] 直接append會變成list[list]所以我才說你要改成extend(row) 原始的code則是邏輯不通,才建議你看一下append怎麼用..

Links booklink

Contact Us: admin [ a t ] ucptt.com