Skip to content

Qt for Python

For discussion and questions about Qt for Python (PySide & Shiboken)

3.3k Topics 14.5k Posts
  • Qt "forbidden" Install Issue

    Unsolved
    3
    0 Votes
    3 Posts
    779 Views
    R
    Sorry, I figured it just failed on the last item in the list above. In any case, I just downloaded the offline version of the installer and it worked fine. This gives me a short cut to Qt Designer so I don't need the kit for Python.
  • Fitting Qimage to pdf page when printing QTextBrowser

    Unsolved
    1
    0 Votes
    1 Posts
    433 Views
    No one has replied
  • loading external UIs

    Moved Solved
    2
    0 Votes
    2 Posts
    588 Views
    A
    #!/usr/bin/python3 import os import sys from PyQt5 import QtCore, QtGui, QtWidgets , uic LOCAL_DIR = os.path.dirname(os.path.realpath(__file__)) + "/" class Main(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.ui = uic.loadUi(LOCAL_DIR + "main.ui", self) self.show() if __name__== '__main__': app = QtWidgets.QApplication([]) gui = Main() sys.exit(app.exec_())
  • How to manage loops with button clicks in PyQt5

    Unsolved
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Qt Designer Property Sheet plugin crashing

    Unsolved
    1
    0 Votes
    1 Posts
    455 Views
    No one has replied
  • QProcess use on Windows

    Solved pyside2 qt for python
    9
    0 Votes
    9 Posts
    2k Views
    D
    OK, so the issue turned out to be something different. We are using QtPy and it needs the environment variable QT_API set to pyside2 for our Windows setup. For some reason the environment passed to QProcess isn't inheriting that variable and it was defaulting to pyside. Setting it manually to pyside2 by calling setProcessEnvironment on our QProcess before the start call gets everything working. Not sure if this is a PySide2 bug or not. The QProcess.execute documentation says: "The environment and working directory are inherited from the calling process." but it doesn't say this explicitly for start.
  • python3/Qt5/gnuplot

    Unsolved
    1
    0 Votes
    1 Posts
    568 Views
    No one has replied
  • Cache QImage

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    Kent-DorfmanK
    @krzysieklfc said in Cache QImage: @Kent-Dorfman I totally missed the concept that QImage references the buffer, not copies it. I included it in my dictionary and now it works. Thank you. Well yeah, reuse of the buffer ist verboten. Gotta make a copy. Glad you figured it out
  • Place Image in PyQt QTableWidget Header

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    L
    Anyone have any clues at all? As you can see from my Stack Exchange question here a user showed that he managed to do it, but then he disappeared.
  • PySide2- Clicked signal of QPushButton doesn't appear

    Unsolved pyside2 python qt for python
    1
    0 Votes
    1 Posts
    438 Views
    No one has replied
  • PySide2 Build from Source Windows 10

    Unsolved
    2
    0 Votes
    2 Posts
    601 Views
    Volodymyr14V
    Better use Anaconda and install PySide2 with conda.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • QThread create in PyQt5

    Unsolved
    11
    0 Votes
    11 Posts
    8k Views
    A
    #!/usr/bin/python3 # Threading example with QThread and moveToThread (PyQt5) import sys import time from PyQt5 import QtWidgets, QtCore class WorkerThread(QtCore.QObject): signalExample = QtCore.pyqtSignal(str, int) def __init__(self): super().__init__() @QtCore.pyqtSlot() def run(self): while True: # Long running task ... self.signalExample.emit("leet", 1337) time.sleep(5) class Main(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.worker = WorkerThread() self.workerThread = QtCore.QThread() self.workerThread.started.connect(self.worker.run) # Init worker run() at startup (optional) self.worker.signalExample.connect(self.signalExample) # Connect your signals/slots self.worker.moveToThread(self.workerThread) # Move the Worker object to the Thread object self.workerThread.start() def signalExample(self, text, number): print(text) print(number) if __name__== '__main__': app = QtWidgets.QApplication([]) gui = Main() sys.exit(app.exec_())
  • Compile with icon.

    Unsolved
    2
    0 Votes
    2 Posts
    431 Views
    Kent-DorfmanK
    my approach to this very issue will be to create a python class that holds the binary data (as arrays) that makes up the icons, then feed that data to QPixmap, and then to QIcon instances.
  • How to convert .py to .ui?

    Unsolved
    2
    0 Votes
    2 Posts
    13k Views
    Kent-DorfmanK
    I'm not aware of any tool to do that. UI is an XML description of the interface. PY is the processed output of that description. I'm not sure anyone has ever identified enough need to go the other direction.
  • How to use QTermWidget in PySide2?

    Unsolved
    4
    0 Votes
    4 Posts
    980 Views
    SGaistS
    Let's take it from the other end, why should the Qt project do it ? There's already a Qt based terminal that exists: Konsole from the KDE project.
  • How to set the style (for instance Material) for QtQuick QML PySide2 app?

    Solved
    3
    0 Votes
    3 Posts
    3k Views
    R
    Thanks, it works!
  • Request for Comments - on my PyQt app

    Unsolved
    2
    0 Votes
    2 Posts
    481 Views
    R
    Tip: add the search/filter input :) to search through the logs.
  • __init__ question

    Unsolved
    2
    0 Votes
    2 Posts
    494 Views
    Kent-DorfmanK
    there are two ways to use forms: The first way is to run the setupUi() method on a target widget. The other way is to subclass the Ui_xxxx class itself. You're probably seeing examples of the second method where the subclass has its own init() method.
  • QListWidget signal in pyside2 and attach a dictionary to listwidget

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    B
    Superb @Erudite-Monkey, This is what i was looking for I am working in a 3d package Maya the reference code i created was from PySide2 import QtWidgets from PySide2 import QtGui from PySide2 import QtCore test_lay = QtWidgets.QVBoxLayout() test_lay_wid = QtWidgets.QWidget() test_parentwid = QtWidgets.QWidget() test_button = QtWidgets.QPushButton() test_listwid = QtWidgets.QListWidget(test_parentwid) #QtWidgets.QListWidgetItem(testing_print.out_var, test_listwid) QtWidgets.QListWidgetItem("Test_01", test_listwid) QtWidgets.QListWidgetItem("Test_02", test_listwid) QtWidgets.QListWidgetItem("Test_03", test_listwid) test_lay.addWidget(test_parentwid) test_lay.addWidget(test_button) test_lay_wid.setLayout(test_lay) test_listwid.insertItem(10, QtWidgets.QListWidgetItem("Test_04")) test_lay_wid.show() def print_someting(): print str(test_listwid.currentItem().text()), "apna time aayega" #test_listwid.currentItem().text() test_listwid.itemClicked.connect(print_someting) which i figured out yesterday night :) I rarely have used lambda but with your eg i'll even learn something better when i select an item(key) from the listwidget it should display data(value) stored in it in texteditwid without any looping -- checked want to use only dict to display data on widget as per model/view want to know its possible, if yes will appreciate examples -- checked You nailed it man didn't even require the last point 3) this query relates partially to the first one, if the dict option isn't handy enough kindly suggest provide an example of loop with itemselected signal because whenever i try i prompts Qt native signal Thank You, @Erudite-Monkey