Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. python
    Log in to post

    • UNSOLVED Switching PySide2 to PyQt5 in Qt Creator
      Qt for Python • python qt for python pyside2 • • hendry33  

      2
      0
      Votes
      2
      Posts
      24
      Views

      It depends on how you create your project/file. If you create a project of the type Application "Qt for Python", you will end up with a main.py where PySide2 is imported and I could not find the template file in the Qt installation files. If you simply create a new file of the type Python | Python Class you will be offered to choose between PyQt5 and Pyside2. The template file is in your Qt installation folder: Qt\Tools\QtCreator\share\qtcreator\templates\wizards\classes\python. Sorry, QtCreator is great but not perfect for Python yet from what I can tell :-/
    • UNSOLVED 3D in PySide questions
      Qt for Python • python pyside • • DoubleFelix  

      2
      0
      Votes
      2
      Posts
      25
      Views

      Hi, You have both Qt's OpenGL module and Qt3D at your disposal for that.
    • UNSOLVED Python and android problem with deploy
      Qt for Python • python qt for python • • Maklo  

      3
      0
      Votes
      3
      Posts
      49
      Views

      Well thanks you
    • UNSOLVED Disable specific Python warnings
      Tools • python • • silenthell  

      3
      0
      Votes
      3
      Posts
      44
      Views

      @JonB I see maybe it'll get better in the future. Yes PyCharm works very well but I'm often developing projects that mix C++ and Python so as you said an integrated experience would be awesome.
    • Problem creating an .exe file
      Qt for Python • python qt for python pyside2 pyside • • RafaelRS  

      3
      0
      Votes
      3
      Posts
      90
      Views

      @Samuel-Bachorik I tried it, but I have the same problem, ehwn I try to execute the .exe file a message box open saying "Failed to execute script"
    • UNSOLVED Run pyqt5 on docker with ui file
      Qt for Python • python qt for python • • eranp03  

      4
      0
      Votes
      4
      Posts
      64
      Views

      Hi, Your application does not run a web server therefore trying to access it with a web browser won't work. You will have to have a X11 server running on your Windows machine. See this article for an explanation about that.
    • UNSOLVED [Solved]QAreaSeries not Showing up. Qt Charts
      Qt for Python • python qt for python • • Qt-Bot05  

      2
      0
      Votes
      2
      Posts
      13
      Views

      Hi, You have here an example of how to build an area series. It's in C++ but easily translated to Python. I think it should provide you with the information you are looking for.
    • UNSOLVED PyQtCharts QAreaSeries. Nothing Show's up.
      Qt for Python • python qt for python • • Qt-Bot05  

      6
      0
      Votes
      6
      Posts
      23
      Views

      @Qt-Bot05 Well, it seems to me you're using Y values the wrong way round for upperSeries and lowerSeries! But I think the docs imply that doesn't actually matter, though you might want to verify by swapping. Also, you're testing with just 2 points, it's an area series so why would you test with less than 4? What are you expecting to see? Anyway, your issue is probably something else. Have you checked it works for you for other than QAreaSeries?
    • UNSOLVED Error (The specified module could not be found / plugin cannot be loaded for module "QtQuick")
      Qt for Python • python qt for python pyside2 pyside • • Ryuyxx  

      2
      0
      Votes
      2
      Posts
      112
      Views

      Did you ever find a fix? Mine is doing the exact same thing.
    • UNSOLVED PySide2 and PySide6 freezes when a QThread contains a PyAudio() stream, while PyQt5 works well. Is that a bug or I had the wrong usage?
      Qt for Python • python qt for python pyside2 • • Haujet Zhao  

      2
      0
      Votes
      2
      Posts
      58
      Views

      @Haujet-Zhao I don't know whether it's "supposed" to work in PySide. PyQt5 is more robust/has more support for other libraries. Have a read anyway of the (only) reply to https://stackoverflow.com/questions/63502837/pyqt5-app-using-timer-to-run-a-function-with-a-loop-makes-it-freeze-up, as possible way forward for PySide2/6?
    • UNSOLVED Running multiple plots with pyside2
      Qt for Python • python qt for python pyside2 pyside • • anoop1  

      8
      0
      Votes
      8
      Posts
      78
      Views

      @anoop1 As I said, how do you expect Python's Cmd.cmdloop to interact with Qt's event-driven system and windows/widgets?
    • SOLVED I can't style my widgets
      Qt for Python • python qt for python • • _jao_victor_  

      13
      0
      Votes
      13
      Posts
      87
      Views

      @JKSH Thanks !!!
    • SOLVED QCommandLinkButton stops working when I recreate it
      Qt for Python • python qt for python pyside2 • • Black Cat  

      2
      0
      Votes
      2
      Posts
      20
      Views

      @Black-Cat You gorgot to connect the clicked signal from the new button...
    • UNSOLVED Variable problem in EventFilter
      Qt for Python • python qt for python • • YassineKira  

      4
      0
      Votes
      4
      Posts
      41
      Views

      @jsulm Thanks i will try to use tour method @JonB i try this, it works Thanks a lot @JonB Now i will do what @jsulm propose i will work withe the qsql
    • UNSOLVED lowercasing function doesn't work in a different function
      Qt for Python • python • • gorgenasty  

      4
      0
      Votes
      4
      Posts
      33
      Views

      @SGaist I assume this is learning exercise! :) He references a learning course he is doing.
    • UNSOLVED Dynamically paint or draw filled and coloured rectangle using pyqt
      Qt for Python • python qt for python • • jacha  

      2
      0
      Votes
      2
      Posts
      73
      Views

      Hi and welcome to devnet, You should add a setter to your widget to pass it the coordinates you want. On a side note, you should call update and not try to call the paintEvent method directly. Depending on your end goal, you might want to consider the Graphics View framework.
    • UNSOLVED Cannot debug with GDB in Qt creator
      General and Desktop • c++ qt creator python gdb gdb error • • Msmh  

      1
      0
      Votes
      1
      Posts
      64
      Views

      No one has replied

    • UNSOLVED How to Disable the QDialog windows in python
      Qt for Python • python qt for python pyside2 pyside • • john14  

      2
      0
      Votes
      2
      Posts
      62
      Views

      @john14 QWidget::setDisabled(bool disable) or setEnabled(bool) are avialble to any QWidget, including a QDialog. If that is what you are wanting.
    • SOLVED Reload paintEvent to draw rect but QLabel can't display pixmap or text
      Qt for Python • python qt for python pyside2 • • klyjm  

      5
      0
      Votes
      5
      Posts
      94
      Views

      @SGaist I don't know how to call it before, now I found using super().paintEvent(arg__1) can solve it.
    • UNSOLVED pyqt5-tools pip install crashes Qgis 'couldn't load sip module. Python support will be disabled'
      Tools • python qt for python pyqt5 qgis qtlinguist • • hcroope  

      2
      0
      Votes
      2
      Posts
      203
      Views

      @hcroope For PyQt question you might ask at: https://riverbankcomputing.com/mailman/listinfo/pyqt
    • UNSOLVED This application failed to start because no Qt platform plugin could be initialized
      Installation and Deployment • python pyside2 mac os 10.15.7 libqcocoa.dylib qt.qpa.plugin • • adsavi  

      22
      0
      Votes
      22
      Posts
      10716
      Views

      Looks like you installed all your stuff in the base conda environment which is a bad idea. I would recommend re-install conda cleanly and create a proper environment to install PySide2.
    • UNSOLVED ImportError: DLL load failed while importing QtCore: The specified module could not be found.
      Qt for Python • python qt for python • • Marceepoo  

      10
      0
      Votes
      10
      Posts
      3694
      Views

      @JonB said in ImportError: DLL load failed while importing QtCore: The specified module could not be found.: cmd /k "C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3 & python.exe E:\Apps\UtilitiesByMarc\PyQt5_Hello_World.py" That was the exactly the solution I was looking for. Thank you sooo much. Often for me, the hardest part is explaining what I am trying to do without providing too long a description. Thank you for seeing what I needed, and showing me how to do it. Much appreciated.
    • SOLVED [MacOS] Global QMenuBar is not clickable
      Qt for Python • python qt for python • • wlgns2223  

      7
      0
      Votes
      7
      Posts
      180
      Views

      You still shouldn't need a workaround. I'd say it's worth a report since it has been working until now.
    • SOLVED WebView crashes when setUrl is called inside a thread
      Qt for Python • python qt for python pyside2 pyside • • mkonst03  

      10
      0
      Votes
      10
      Posts
      84
      Views

      I highly encourage you to learn the signals and slots paradigm. Qt is an asynchronous framework which means that you may not need an additional thread depending on what you need to process and how you process it. Did they warm you about the nuclear footgun that it can be ? ;-)
    • SOLVED Reading python script and store as string at compile time?
      General and Desktop • python string • • lansing  

      3
      0
      Votes
      3
      Posts
      47
      Views

      @mrjj Thanks I tried the resource system and it works. QFile file(":/python_scripts/script1.py"); file.open(QIODevice::ReadOnly | QIODevice::Text); QString pythonScript = file.readAll();
    • UNSOLVED Displat Depth image in PyQT4
      Qt for Python • python qt for python • • Lucien  

      6
      0
      Votes
      6
      Posts
      103
      Views

      @Lucien said in Displat Depth image in PyQT4: requires some colors in it (RGB/Mono/Grayscale) which does not fit in Mono and greyscale do not have colors, so don't know what the problem is... "QImage::Format_Mono 1 The image is stored using 1-bit per pixel. Bytes are packed with the most significant bit (MSB) first.". "QImage::Format_Grayscale8 24 The image is stored using an 8-bit grayscale format. (added in Qt 5.5) QImage::Format_Grayscale16 28 The image is stored using an 16-bit grayscale format. (added in Qt 5.13)"
    • SOLVED Delay to open window after use my desktop app(open and close many windows), when more windows I open, larger will be the delay
      Qt for Python • python qt for python pyside2 • • andre_sophia  

      16
      0
      Votes
      16
      Posts
      129
      Views

      @andre_sophia Glad it solved. Yes, in the normal course do all your connect()s in the __init__(), after the setupUi(), so it's just once.
    • UNSOLVED How to overlay a text with an video (QVideoWiget)
      Qt for Python • python • • amaimon02  

      3
      0
      Votes
      3
      Posts
      177
      Views

      I have never used QVideoWidget, but based on some prior experience with different GUI frameworks, I would caution that your results may vary by operating system, and by whatever underlying video playback engine is ultimately responsible for getting the video pixels on the screen. I tried to do something like this a while ago, and on one platform the text window (a transparent window with opaque text) that I tried to place on top of the video window worked just fine. On another platform the text was barely noticeable. You could only notice it flicker into view occasionally, like some kind of subliminal messaging. I believe the reason for the unwanted "flicker behavior" on that system was due to the video engine constantly writing directly to the video card, bypassing any attempts at layering/compositing.
    • UNSOLVED QNetworkAccessManager https UnknownNetworkError when using pyside2
      Qt for Python • python qt for python pyside2 • • belalshehab  

      7
      0
      Votes
      7
      Posts
      193
      Views

      I installed it using pip pip install pyside2 I'm on windows using python 3.7
    • SOLVED Problem linking to libQt5*.so (Linux)
      Qt for Python • python • • DavidCY  

      3
      0
      Votes
      3
      Posts
      113
      Views

      LD_PRELOAD=/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Concurrent.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Core.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5DBus.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Gui.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Network.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5OpenGL.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Positioning.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5PrintSupport.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Sql.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Svg.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Widgets.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5XcbQpa.so:/home/david/.local/lib/python3.7/site-packages/ccdc/_lib/libQt5Xml.so python3.7 Python 3.7.8 (default, Jul 20 2020, 18:03:39) [GCC 10.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ccdc >>> Worked like magic. 😲 Thanks a lot, @SGaist !
    • SOLVED QProcess waitForFinish exits immediately
      General and Desktop • python qprocess script output • • Kyeiv  

      7
      0
      Votes
      7
      Posts
      133
      Views

      @Kyeiv OK, but please put the error checking code in anyway. With OS commands you never know what might go wrong (just like you discovered), so it's important to check for & report all errors! And especially if you are going to be distributing this....
    • UNSOLVED QT designer и python
      Qt for Python • python qt for python pyside2 • • VOLFRAMHERO  

      16
      0
      Votes
      16
      Posts
      135
      Views

      Okay I cannot understand what the actual issue is but I went through and created that window with what I believe are all its bells and whistles and have rendered it below. Hope this helps solve whatever the issue is/was?? # -*- coding: utf-8 -*- #Изначально подключаются необходимые библиотеки from PyQt5.QtCore import pyqtSlot, QSize from PyQt5.QtGui import QFont, QColor, QPalette from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout from PyQt5.QtWidgets import QPushButton, QLabel, QLineEdit class HeaderLabel(QLabel): def __init__(self, Text): QLabel.__init__(self) # ------- self.setText(Text) # ------- FontHeader = QFont() FontHeader.setFamily('Segoe Print') FontHeader.setPointSize(14) # ------- self.setFont(FontHeader) self.setStyleSheet('QLabel:hover {color:red}') class BasicButton(QPushButton): def __init__(self, Text, Width): QPushButton.__init__(self) # ------- self.setText(Text) # ------- BtnSize = QSize(Width, 61) self.setFixedSize(BtnSize) # ------- StyleValues = 'QPushButton {' StyleValues += 'background-color:grey; ' StyleValues += 'border:none; ' StyleValues += 'color:white; ' StyleValues += ' } ' StyleValues += 'QPushButton:hover{' StyleValues += 'background-color:white; ' StyleValues += 'color:black; ' StyleValues += ' } ' self.setStyleSheet(StyleValues) self.setAutoFillBackground(True) # ------- BtnFont = QFont() BtnFont.setPixelSize(20) BtnFont.setBold(True) self.setFont(BtnFont) # ------- self.setAutoExclusive(False) self.setAutoDefault(False) self.setAutoRepeat(False) self.setDefault(False) self.setFlat(False) class CenterPanel(QWidget): def __init__(self, parent): QWidget.__init__(self) self.Parent = parent # ------- Palet = QPalette() Palet.setColor(QPalette.Window, QColor(243, 239, 255)) self.setPalette(Palet) self.setAutoFillBackground(True) # ------- lblHeadr1 = HeaderLabel('Введите текст') # ------- HBox1 = QHBoxLayout() HBox1.addStretch(1) HBox1.addWidget(lblHeadr1) HBox1.addStretch(1) # ------- self.lneBigArea1 = QLineEdit() self.lneBigArea1.setMinimumHeight(121) self.lneBigArea1.setMaximumHeight(121) self.lneBigArea1.setReadOnly(False) # ------- HBox2 = QHBoxLayout() HBox2.addWidget(self.lneBigArea1) # ------- self.btnOne = BasicButton('Очистить поля', 181) self.btnOne.clicked.connect(self.Shift) # ------- self.btnTwo = BasicButton('Выполнить', 171) self.btnTwo.clicked.connect(self.DoNothing) # ------- HBox3 = QHBoxLayout() HBox3.addWidget(self.btnOne) HBox3.addSpacing(40) HBox3.addWidget(self.btnTwo) HBox3.addStretch(1) # ------- lblHeadr2 = HeaderLabel('Результат преобразования') # ------- HBox4 = QHBoxLayout() HBox4.addStretch(1) HBox4.addWidget(lblHeadr2) HBox4.addStretch(1) # ------- self.lneBigArea2 = QLineEdit() self.lneBigArea2.setMinimumHeight(131) self.lneBigArea2.setMaximumHeight(131) self.lneBigArea2.setStyleSheet("background:transparent;") self.lneBigArea2.setReadOnly(True) # ------- HBox5 = QHBoxLayout() HBox5.addWidget(self.lneBigArea2) # ------- self.btnTre = BasicButton('Закрыть программу', 241) self.btnTre.clicked.connect(self.CloseApp) # ------- HBox6 = QHBoxLayout() HBox6.addStretch(1) HBox6.addWidget(self.btnTre) # ------- VBox = QVBoxLayout() VBox.addLayout(HBox1) VBox.addLayout(HBox2) VBox.addSpacing(20) VBox.addLayout(HBox3) VBox.addSpacing(20) VBox.addLayout(HBox4) VBox.addSpacing(20) VBox.addLayout(HBox5) VBox.addLayout(HBox6) VBox.addStretch(1) # ------- self.setLayout(VBox) @pyqtSlot() def Shift(self): intab = 'абвгдежзийклмнопрстуфхцчшщъыьэюя АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ' outtab = 'яюэьыъщшчцхфутсрпонмлкйизжедгвба5ЯЭЮЬЫЪЩШЧЦХФУТСРПОНМЛКЙИЗЖЕДГВБА' # I have no idea what this is doing other than it takes something from the # first box and puts it in the second box trans = self.lneBigArea1.text() self.lneBigArea2.setText(trans.translate(str.maketrans(intab, outtab))) # Так как программа закрывается сразу же после ее запуска, то пришлось оставить строчку для ввода # input(" Нажмите для выхода ... ") @pyqtSlot() def DoNothing(self): self.Parent.SetStatus('Sorry I do not do anything') @pyqtSlot() def CloseApp(self): self.Parent.CloseApp() class MainDisply(QMainWindow): def __init__(self): QMainWindow.__init__(self) Top=300; Left=500; Width=618; Hight=538 self.setGeometry(Left, Top, Width, Hight) self.setWindowTitle('Атбаш') self.CenterPane = CenterPanel(self) self.setCentralWidget(self.CenterPane) self.StatusMsg = self.statusBar() def SetStatus(self, Text): self.StatusMsg.showMessage(Text) def CloseApp(self): self.close() if __name__ == "__main__": MainEventHandler = QApplication([]) # Следующий код отвечает за открытие интерфейса MainApplication = MainDisply() MainApplication.show() # Выход из приложения MainEventHandler.exec()
    • UNSOLVED How to customize/create a Wheel Event?
      Qt for Python • python qt for python • • SoleyRan  

      5
      0
      Votes
      5
      Posts
      87
      Views

      okay the PyQt5 QWheelEvent is documented and pretty straight forward as to how to use it -- that is if I understand what you are asking since you did not provide an MRE to make it more clear def self.wheelEvent(self, WheelEvent): that is how you would define it within the Object that is handling the Wheel Event such as your QMainWindow or whatever you are using for main GUI -- then all you have to do is handle that Wheel Event correct which is also covered in the documentation Or are you actually trying Emit a QWheelEvent if this then you need to look into defining the QWheelEvent and than simply emit the WheelEvent once you have created it and set the parameters you wish to set which you do not have to do all at once as most widgets have -- setThis methods -- thus you would start here WheelEvent = QWheelEvent()
    • UNSOLVED How to generate python bindings using shiboken from an existing C++/Qt shared library?
      Language Bindings • python python3 python support shiboken • • Alex94102  

      6
      0
      Votes
      6
      Posts
      212
      Views

      Thanks for the links !
    • UNSOLVED Why fonts in Qt are appearing blurry or pixelated?
      Qt for Python • python qt for python pyside2 pyside • • Abhay Salvi  

      13
      0
      Votes
      13
      Posts
      631
      Views

      So, if you can set the font size in points and only use those available in Notepad's list of sizes you should be ok.
    • SOLVED Printing html using QWebEngineView fails (PyQt5)
      Qt for Python • python qt for python • • Koenux  

      2
      0
      Votes
      2
      Posts
      460
      Views

      I've got a bit further than yesterday with this issue. I went back to the example on this website: http://quabr.com:8182/59438021/how-do-i-create-a-print-preview-of-qwebengineview-in-pyqt5 The problem has to do something with: printer = QPrinter(QPrinter.HighResolution) When I use QPrinter() without the HighResolution part, everything works as expected. I didn't realise that the example had the same problem since it calls the printPreview method which doesn't have the resolution part. Is this a bug in (Py)Qt? Since my problem is fixed, I'm will mark it as solved.
    • SOLVED Remove duplicate entries from QListWidget?
      Qt for Python • python qt for python • • Sebastian1993  

      13
      0
      Votes
      13
      Posts
      667
      Views

      Yes @Sebastian1993 I have numerous solutions ;) I teach python-qt online for free however it would be more efficient for me if you would post a MUC/MRE (Minimal Usable Code example / Minimal Reproducible Example) of your code and let me look at what you are doing and help you adjust that to do what I suggested while trying to keep most of what you have
    • SOLVED Installing PySide2 on Raspberry Pi
      Qt for Python • python qt for python pyside2 • • Niagarer  

      9
      0
      Votes
      9
      Posts
      4971
      Views

      @lolcocks Thanks! I had to add "sudo" at the begining of the command line to make it work on my raspberry Pi 3B+.
    • UNSOLVED How to create a dynamic QLineEdit for a line joining two circles?
      Qt for Python • python qt for python • • Disha  

      2
      0
      Votes
      2
      Posts
      93
      Views

      Hi and welcome to devnet, Rather than just posting code, you should also explain exactly what you want to achieve.