Skip to content
  • 0 Votes
    2 Posts
    1k Views
    eyllanescE
    @SCP173 Try with: import sys import random from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine, qmlRegisterType from PySide6.QtCore import QUrl from PySide6.QtCore import QObject, Signal, Slot class NumberGenerator(QObject): def __init__(self): QObject.__init__(self) nextNumber = Signal(int) @Slot() def giveNumber(self): self.nextNumber.emit(random.randint(0, 99)) if __name__ == '__main__': app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() qmlRegisterType(NumberGenerator, 'Generators', 1, 0, 'NumberGenerator') engine.load(QUrl("main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec()) import QtQuick 2.0 import QtQuick.Window 2.0 import QtQuick.Controls 2.0 import Generators 1.0 Window { id: root width: 640 height: 480 visible: true title: "Hello Python World!" Flow { Button { text: "Give me a number!" onClicked: numberGenerator.giveNumber(); } Label { id: numberLabel text: "no number" } } NumberGenerator { id: numberGenerator // Signal argument names are not propagated from Python to QML, so we need to re-emit the signal signal reNextNumber(int number) Component.onCompleted: numberGenerator.nextNumber.connect(reNextNumber) } Connections { target: numberGenerator function onReNextNumber(number){ numberLabel.text = number } } }
  • Incorrectly passed from class to class

    Unsolved General and Desktop python
    6
    0 Votes
    6 Posts
    342 Views
    S
    @jsulm It looks like [image: 057cf4cd-77e5-455b-ad9e-678ecbf4c09e.jpg]
  • How to close the Pdf file while closing the application?

    Unsolved General and Desktop qt5 python
    2
    0 Votes
    2 Posts
    359 Views
    mrjjM
    Hi Well you ask the OS to open any app that is tied to the extension pdf. Its not really possible to ask it to close without using platform native api calls to find this window and try to close it. You could use https://doc.qt.io/qt-5/qtpdf-index.html to display the pdf yourself and hence be able to close the pdf view.
  • 0 Votes
    1 Posts
    378 Views
    No one has replied
  • 0 Votes
    3 Posts
    588 Views
    R
    Hello, did you find a solution? I have the same problem.But I found that this only occurs in a Wayland session and Gnome. Even in gnome and xorg this problem does not happen.
  • PydanticSlot Decorator

    Unsolved Qt for Python qt for python pyside python
    4
    2 Votes
    4 Posts
    1k Views
    S
    @SGaist thank you for the advice, I think that I will take you up on that!
  • Need advice with new project (Should I use PyQT)

    Unsolved Qt for Python qt for python python
    7
    0 Votes
    7 Posts
    1k Views
    jeremy_kJ
    @jash said in Need advice with new project (Should I use PyQT): @jeremy_k thanks, the diagram scene does look pretty similar to what I intend to do. Does it give the diagram information which I can use to know how the graph looks? I'm not quite clear on the question. If you're referring to generating a data structure suitable for traversing the graph, I believe that I implemented my own by adding code to the existing functions. E.g. DiagramItem.__init__() from the example linked below provides an opportunity to track new objects in the diagram. I'm okay with learning and don't want to run away from it. Is there a python example I can look at? For PySide/Qt for Python https://doc.qt.io/qtforpython-6/examples/example_widgets_graphicsview_diagramscene.html I recall seeing PyQt ports of the examples, but don't have a link handy.
  • 0 Votes
    2 Posts
    7k Views
    jeremy_kJ
    What imports and other code are executed before the QApplication is created? Does a minimal working example trigger the same behavior? Does the same code work when not part of a PyInstaller executable? If the problem only surfaces when using PyInstaller, look at the hooks that are executed. The problem is likely as the error message says: You might be loading two sets of Qt binaries into the same process. The first block of messages suggest it to be a conflict between PyQt5 and PhoneBot.app.
  • QStandardItemModel custom sorting rules

    Solved Qt for Python pyside2 python
    6
    0 Votes
    6 Posts
    1k Views
    JonBJ
    @QueTeeHelper Exactly right, those are the comments I would have typed if it were my code :)
  • Odd issue, thread worker & timmer not running properly

    Unsolved Qt for Python pyside2 python
    10
    0 Votes
    10 Posts
    1k Views
    D
    @kshegunov said in Odd issue, thread worker & timmer not running properly: Does the timer start at all? Does the thread start at all? the timer.start() gets called. But after that silence... Maybe everything gets deleted somewhere?
  • Switching PySide2 to PyQt5 in Qt Creator

    Unsolved Qt for Python qt for python python pyside2
    2
    0 Votes
    2 Posts
    1k Views
    LimeyLimeL
    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 :-/
  • 3D in PySide questions

    Solved Qt for Python pyside python
    2
    0 Votes
    2 Posts
    522 Views
    SGaistS
    Hi, You have both Qt's OpenGL module and Qt3D at your disposal for that.
  • Python and android problem with deploy

    Unsolved Qt for Python qt for python python
    3
    0 Votes
    3 Posts
    613 Views
    M
    Well thanks you
  • Disable specific Python warnings

    Unsolved Qt Creator and other tools python
    4
    0 Votes
    4 Posts
    2k Views
    T
    The linting is performed by pylsp, documentation for this can be found here: https://github.com/python-lsp/python-lsp-server There is not a great deal of configuration for this in QtCreator however if you create: ~/.config/pycodestyle You can add something like this to ignore specific rules: [pycodestyle] ignore = E226, E722, W504, E501 Also if you are interested in what pylsp is doing you can modify its command line to generate logs: [image: pylsp_config.png]
  • Problem creating an .exe file

    Qt for Python pyside2 python qt for python pyside
    3
    0 Votes
    3 Posts
    1k Views
    R
    @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"
  • Run pyqt5 on docker with ui file

    Unsolved Qt for Python python qt for python
    4
    0 Votes
    4 Posts
    5k Views
    SGaistS
    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.
  • [Solved]QAreaSeries not Showing up. Qt Charts

    Unsolved Qt for Python qt for python python
    2
    0 Votes
    2 Posts
    499 Views
    SGaistS
    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.
  • PyQtCharts QAreaSeries. Nothing Show's up.

    Unsolved Qt for Python qt for python python
    6
    0 Votes
    6 Posts
    937 Views
    JonBJ
    @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?
  • 0 Votes
    2 Posts
    1k Views
    C
    Did you ever find a fix? Mine is doing the exact same thing.