pyqt

Pyqt5: Attempting to add QLayout “ ”Form", which already has a layout (multiple inheritance python) [duplicate]

一笑奈何 提交于 2021-02-20 04:30:07
问题 This question already has answers here : QtDesigner changes will be lost after redesign User Interface (2 answers) Closed 10 months ago . i have created a ui file, window.ui (consist with a tab widget) and a Widget file student (some buttons,functions) using qtDesigner and than convert into py file using pyuic5. and inherit in a separate file like mainWindow.py and mainStudent.py . i added a tabWidget into mainWindow.py and i want to call the page student.py from the tab . so i create a new

Dynamic size of QTreeWidget in PyQt5

我的梦境 提交于 2021-02-20 04:12:36
问题 I got a QTreewidget, which i want to be as small as possible, with probably only one branch. But i want the size to change accordingly to how that expands or collapses. As well as start out with a size that fits the filled part of the widget. I make the QTreewidget by adding QTreeWidgetItems, which got the TreeWidget as parent, and then making QTreeWidgetItems again which got the above QTreeWidgetItem as parent. Right now, it starts like left image, but i want it to start like the right one.

Dynamic size of QTreeWidget in PyQt5

给你一囗甜甜゛ 提交于 2021-02-20 04:12:32
问题 I got a QTreewidget, which i want to be as small as possible, with probably only one branch. But i want the size to change accordingly to how that expands or collapses. As well as start out with a size that fits the filled part of the widget. I make the QTreewidget by adding QTreeWidgetItems, which got the TreeWidget as parent, and then making QTreeWidgetItems again which got the above QTreeWidgetItem as parent. Right now, it starts like left image, but i want it to start like the right one.

insert multiple input fields before running scrapy

﹥>﹥吖頭↗ 提交于 2021-02-19 08:30:06
问题 I'm referencing a stackoverflow answer that is similar to my GUI app. My scrappy application is a bit different. When exectuing the app, a user is prompt to enter keywords for scrapy to search for looks like this im trying to put this logic on the GUI, but im unsure how to do it. here is what the gui looks like as of now. I want to be able to input fields where a user can input the information need before processing the scrapy script. here is a bit of the scrapy script my_spider.py import

Prevent ComboBox editing in StyledItemDelegate

对着背影说爱祢 提交于 2021-02-19 08:16:16
问题 I am trying to make everything shown by the current code un-editable. Previous searches all suggest either modifying the flags() function of the model or using the setEditTriggers of the table. I do both in this code, but neither of them work. Looking at a widget-by-widget case, I can find readonly modes for LineEdit and others, but not for ComboBox. So I can not even modify the delegate to force the readonly constraint, not that I would necessarily like to do it this way. EDIT: to clarify,

how to let serial work well background and also foreground?

只谈情不闲聊 提交于 2021-02-19 08:13:05
问题 i have a serial app, The Robot class need to always receive serial message and then to do some thing, the Demo gui need to interactive Robot and get Robot.handle_readData , if no data get, need to get again and again until had data. Now i had no idea how to solve this problem, need someone give me good idea. from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtSerialPort import * class Robot(QObject): def __init__(self): super().__init__() self

How to get a current Item's info from QtGui.QListWidget?

大城市里の小女人 提交于 2021-02-18 21:57:52
问题 Created a QtGui.QListWidget list widget: myListWidget = QtGui.QListWidget() Populated this ListWidget with QListWidgetItem list items: for word in ['cat', 'dog', 'bird']: list_item = QtGui.QListWidgetItem(word, myListWidget) Now connect a function on list_item's left click: def print_info(): print myListWidget.currentItem().text() myListWidget.currentItemChanged.connect(print_info) As you see from my code all I am getting on a left click is a list_item's label name. But aside from a label

How to get a current Item's info from QtGui.QListWidget?

妖精的绣舞 提交于 2021-02-18 21:57:36
问题 Created a QtGui.QListWidget list widget: myListWidget = QtGui.QListWidget() Populated this ListWidget with QListWidgetItem list items: for word in ['cat', 'dog', 'bird']: list_item = QtGui.QListWidgetItem(word, myListWidget) Now connect a function on list_item's left click: def print_info(): print myListWidget.currentItem().text() myListWidget.currentItemChanged.connect(print_info) As you see from my code all I am getting on a left click is a list_item's label name. But aside from a label

How can I customize the QCompleter popup window in PyQt?

耗尽温柔 提交于 2021-02-18 21:50:27
问题 I have a few things for a QLineEdit's QCompleter I'm interested in customizing. I want to make it behave similar to the address / search bar in Chrome. How can I limit the number of rows that are displayed? For example, even if there are 15 matches, I only want the QCompleter to show 5. How can I resize the popup window? For example, I want to make the popup window nice and snug. As per the above example, I want the popup window to resize to 5 rows exactly without any showing any ugly scroll

How to make QTableView refresh Background color after it loads data again

空扰寡人 提交于 2021-02-18 19:12:49
问题 i have the following doubt regarding QTableView , i have added some code that changes the row background depending on what string the dataframe contains on the last column. def data(self, index, role=Qt.DisplayRole): if index.isValid(): if role == Qt.BackgroundRole: if df.iloc[index.row(),5] == "Ready for QC": return QBrush(Qt.yellow) if df.iloc[index.row(),5] == "In Progress": return QBrush(Qt.green) if role == Qt.DisplayRole: return str(self._data.iloc[index.row(), index.column()]) return