pyside2

How to create a basic custom QGraphicsEffect in Qt?

て烟熏妆下的殇ゞ 提交于 2020-02-16 09:54:12
问题 I have been trying to create a basic QGraphicsEffect to change the colors of the widget, but first I tried to make an effect that does nothing like so: class QGraphicsSepiaEffect(QtWidgets.QGraphicsEffect): def draw(painter): pixmap = sourcePixmap() painter.drawPixmap(pixmap.rect(), pixmap) I am using PySide2. Though I checked all over the internet but couldn't find any sample, neither a template nor a real custom effect. How can I write a basic effect to alter the colors of my widget? 回答1:

How many times the most I can change the background of the pushButton?

半城伤御伤魂 提交于 2020-02-16 05:47:47
问题 So , I am trying to blink the push button with the color that I pass and between white. And it only seems to blink it so many times after that code would crash. I have tried it to implement the blinking with different blink rates and it would it still break at some time. in 'a' I have the string like "Background-color: rgb(255,0,0)". in 'timings' i have a list like[208, 280]or it could be [48,32,48,32,100,280], this represents the on and off timings 'zeroth index' represents on and 'index 1'

How many times the most I can change the background of the pushButton?

浪尽此生 提交于 2020-02-16 05:47:10
问题 So , I am trying to blink the push button with the color that I pass and between white. And it only seems to blink it so many times after that code would crash. I have tried it to implement the blinking with different blink rates and it would it still break at some time. in 'a' I have the string like "Background-color: rgb(255,0,0)". in 'timings' i have a list like[208, 280]or it could be [48,32,48,32,100,280], this represents the on and off timings 'zeroth index' represents on and 'index 1'

Qt “passthrough” or “container” widget

耗尽温柔 提交于 2020-02-05 02:36:32
问题 In Qt / PySide2, is there such a thing as a Qt widget that simply passes through to a wrapped widget, without adding any extra layers of layout etc. I'm coming from a web frontend background, so my mental model is of a React container component that adds some behavior but then simply renders a wrapped presentational component. However, there doesn't seem to be a way of doing this sort of thing in Qt without at least creating a layout in the wrapping widget, even if that layout only contains

Get QComboBox item text triggered by event in separate class method/function

妖精的绣舞 提交于 2020-01-24 19:39:12
问题 I'm having trouble getting any information from a QComboBox other than the index in a function. Most similar examples provides the function in the same class as the triggered event. I'm trying to get this from an external class (and file). Folder structure is as provided in the answer here: PySide2 paint on widget created by designer In paintEventTest.py I've created a list which is used to populate the combobox with items. ComboEvent is instantiated from EventMethods.py and I'm trying to

PySide2 Qthread crash

╄→尐↘猪︶ㄣ 提交于 2020-01-24 17:55:12
问题 I want to use PySide2 Qtcore.Qthread because of Qtcore.Signal, but I end up with this error: Process finished with exit code -1073740791 from PySide2.QtCore import QThread class Thread(QThread): def run(self): print('task started') k = 0 for i in range(10000): for j in range(5000): k += 1 print('task finished') Thread().start() expect to have those prints but I have this error: Process finished with exit code -1073740791 Update: so, why this code also throw the same error? class Thread

Rebuilding a window

风流意气都作罢 提交于 2020-01-23 17:27:27
问题 I am using PySide2 to rebuild a window like seen in the screenshot(what you see in the screenshot is an example, Ueli App launcher, available on Github), it's an app launcher, but since I am very new to PySide2 I do not know a lot of functions and asking here for help, where I should look into. What I need: I type something into the textfield(on the screenshot where it says 'test') and options that fulfill my conditions get appended to UI so that I can select them with the arrow keys and

Show progressbar in Qt with computationally heavy background process

扶醉桌前 提交于 2020-01-23 04:02:29
问题 I'm building an application that let's the user export his/her work. This is a computationally heavy process, lasting for a minute or so, during which I want to show a progress bar (and make the rest of the UI unresponsive). I've tried the implementation below, which works fine for a non-computationally expensive background process (e.g. waiting for 0.1 s). However, for a CPU heavy process, the UI becomes very laggy and unresponsive (but not completely unresponsive). Any idea how I can solve

How to make an .exe file from python project with qt framework(pyside2) with cx_freeze properly?

人盡茶涼 提交于 2020-01-16 11:17:09
问题 I've searched this for quite a while and I give up. I've created setup.py file with all needed options. Call "python setup.py build" and I got the .exe file which is working, but only on my computer. When I'm trying to launch that file on the other computer - it fails to start. Because in all the chains of modules in the last one ther is something like it: "F:\*myfilepath from the original system to*\lib\site-packages\shiboken2\__init__.py", line 27 in <module> ImportError: DLL load failed:%1

How to make an .exe file from python project with qt framework(pyside2) with cx_freeze properly?

最后都变了- 提交于 2020-01-16 11:16:01
问题 I've searched this for quite a while and I give up. I've created setup.py file with all needed options. Call "python setup.py build" and I got the .exe file which is working, but only on my computer. When I'm trying to launch that file on the other computer - it fails to start. Because in all the chains of modules in the last one ther is something like it: "F:\*myfilepath from the original system to*\lib\site-packages\shiboken2\__init__.py", line 27 in <module> ImportError: DLL load failed:%1