pyside2

would like not clickable/highlighted icons in listWidget

房东的猫 提交于 2021-02-05 08:07:03
问题 I have QListWidget in Pyside2 that has icons populating it. I dont like the icons taking on a shaded grey look when the mouse clicks them. Is there a way to disable this action? I will include a picture. 回答1: You have to use a delegate that disables the QStyle::State_Selected flag: from PySide2 import QtCore, QtGui, QtWidgets class StyledItemDelegate(QtWidgets.QStyledItemDelegate): def initStyleOption(self, option, index): option.state &= ~QtWidgets.QStyle.State_Selected super

Python crashes when running a log streamer using Qt

百般思念 提交于 2021-02-05 06:23:04
问题 Goal I have a process that logs on a file (realtime.log) while running and I want to print every new line of that file in my application in realtime. In other words I want to redirect the output from the process to the GUI. This means that I have two different processes running: the "engine" and the GUI. I have already achieved this by using Tkinter but since I have to make a more complex, professional and good looking GUI I decided to switch to Qt for Python ( PySide2 ). Problem Python often

Opening new window while out of focus using “keyboard”

会有一股神秘感。 提交于 2021-02-02 09:28:26
问题 I am trying to track my keypresses, using the module "keyboard" while a PySide2 Widget is not in focus, which works fine. However when I try to create a new Widget using a "keyboard" shortcut the program crashes. Opening a window on a button press works fine. I can also call non UI functions using "keyboard" eg. the print function without any problem. Do you know a way to fix this and open a new window using "keyboard" or any other method, while a PySide2 window is not in focus. In this

The window.ui with form conveted converted to window.py error in PySide2.QtWidgets.QTabWidget(MyWindow)

跟風遠走 提交于 2021-01-29 20:13:03
问题 I create a window and in the Python code I did: def __init__(self): try: super(QDialog, self).__init__() super(MyWindow, self).__init__() self.ui = uic.loadUi('CreateUsers.ui', self) You can show that I used "CreateUsers.ui" file, but I used pyside2-uic CreateUsers.ui > ui_create_user.py and tried to use with this way: def __init__(self): try: super(QDialog, self).__init__() super(MyWindow, self).__init__() #self.ui = uic.loadUi('CreateUsers.ui', self) self.ui = Ui_Form() self.ui.setupUi(self

QML: how to register user custom shortcut

▼魔方 西西 提交于 2021-01-29 16:40:02
问题 I'm currently learning Qt by developing a simple desktop app with Python and QML. The document about Pyside2 with QML is surprisingly insufficient. Anyway, now I'm struggling with user custom shortcut key registering. Some app have a text field in which you can press a key combination and that combination will show in the text field. something like this image According to the official document, there's a QKeySequenceEdit in C++. Is there any way to do this in QML ? Or at least in Pyside2 ? Or

The window.ui with form conveted converted to window.py error in PySide2.QtWidgets.QTabWidget(MyWindow)

こ雲淡風輕ζ 提交于 2021-01-29 16:12:43
问题 I create a window and in the Python code I did: def __init__(self): try: super(QDialog, self).__init__() super(MyWindow, self).__init__() self.ui = uic.loadUi('CreateUsers.ui', self) You can show that I used "CreateUsers.ui" file, but I used pyside2-uic CreateUsers.ui > ui_create_user.py and tried to use with this way: def __init__(self): try: super(QDialog, self).__init__() super(MyWindow, self).__init__() #self.ui = uic.loadUi('CreateUsers.ui', self) self.ui = Ui_Form() self.ui.setupUi(self

Execute command to a Python script from separate Python script?

点点圈 提交于 2021-01-29 07:26:23
问题 I'm trying to send a command from one python script to another running in terminal. I'm running two python scripts on an RPi running Raspbian. The first script is a loop that waits for the user to enter a number and adds it to a total. The second script uses PySide2 to print a number when a QPushButton is released. How can i make it so that the function that runs when the QPushButton is released, sends a command (or variable) into the waiting first script and executes it? I've read some

install PySide2 on python 2.7

僤鯓⒐⒋嵵緔 提交于 2021-01-29 04:03:42
问题 Trying for days but can't install PySide2 on python 2.7.15 while got no problem on python 3.7. On Qt for python(which is the project name for the module PySide2) website at is written explicitly that python 2.7 is supported so that should be no problem. I succeeded installing PySide2 on python 3 using: pip install PySide2 then i tried installing PySide2 on python 2 using: python -m pip install PySide2 which yelled error: ERROR: Could not find a version that satisfies the requirement PySide2

With PySide2 and QTableView how do i get multiple delegates in table view using pandas model?

烈酒焚心 提交于 2021-01-28 08:40:39
问题 hi i've tried all i can think of and had looked at hundreds of stack overflow questions about tables and delegate's, and scratched my head for hours looking at the documentation trying to understand the c++ language and i have not read anything clearly stating that there's limits to the of amount delegate's a table view can take and not take, now i hope i can say i've got a firm understanding of the basic's in pyside2 and pyqt5 especially with tables and models but the delegates is a bit mind

How to embed basic HTML page using Qt?

╄→尐↘猪︶ㄣ 提交于 2021-01-28 07:16:25
问题 I am using PySide2.QtWebEngineWidgets.QWebEngineView() to setHtml on it to show a basic page like below. This html file works fine in a browser because it has all the files in the same folder relative to the html file. Once I setHtml to the below file, I get this exception: Qt Error: Uncaught ReferenceError: require is not defined Is this related to Qt not finding the relative files unlike a regular browser? Or is there something else I should be doing? Or is QWebEngineView not advanced