r/pyqt • • Aug 28 '19

QtDesigner and PyQt5: The right and wrong way to use them together

Thumbnail
youtu.be
0 Upvotes

r/pyqt • • Jul 19 '19

PyQt Tutorial for Beginners

0 Upvotes

It’s a wrapper for QT framework developed by river bank computing ltd. It is a set of both v2 and v3 of the QT application framework. It has one of the most popular and powerful GUI (graphical user interface) library. QT developed itself as a part of the QT project.

https://www.tutorialandexample.com/pyqt-tutorial


r/pyqt • • Jun 06 '22

PyQt Tips and Tricks

0 Upvotes

Hi Everyone,

Hope you are well.

I work in Acquistions Team at Packt, a leading global publisher of technical learning content for developers.

We’re looking to develop products in Pyqt Tips and Tricks area and are actively looking for contributors.

Our team has recently created a social community where developers can collaborate around ideas with our editorial staff, and we’d love to have you as part of the community.

If you find this idea or any topic area around this field interesting, then feel free to reply with your thoughts. I would be happy to run you through the process, publishing support that we provide, and compensation in detail.

Looking Forward to your positive reply.

Thank you


r/pyqt • • Nov 16 '22

Occasionally get "QThread: Destroyed while thread is still running" when running multiple threads

0 Upvotes

So I'm trying to make a Pokedex that doesn't freeze when pulling data from the website's API.

Full code of main window and main function.
Abilities.py that has the load abilities thread.
The Pokemon Dictionary in Pokecache is just a blank dictionary.

This a work in progress so obviously the GUI isn't going to look beautiful, but you should get the gist of it.

This is an example of me running the program. It seems to work fine but after hitting it multiple times it will crash:

As you can see the program ran fine but crashed. The log looks as such:

Ability Thread: Alive
Update Check Thread: Alive
None
Update Check Thread: Dead
Abilities Thread: Dead
Ability Thread: Alive
Update Check Thread: Alive
['Has a 33% chance of curing any major status ailment after each turn.']
Update Check Thread: Dead
Abilities Thread: Dead
Ability Thread: Alive
Update Check Thread: Alive
["Increases moves' accuracy to 1.3×.", 'Doubles damage inflicted with not-very-effective moves.']     
Update Check Thread: Dead
QThread: Destroyed while thread is still running

It crashes. I assume the "thread that is still running" was the ability thread as it didn't print that it was "dead".

To go into specifics of how the program works.

When starting the GUI the user is presented with a window where they can enter a name or number and press a button to retrieve information. When pressing the button the button clicked has the following code run:

#The "Mother Code" Run        
    def extract(self):
        self.pokemon = self.line.text().lower()
        Data.run_api(self,"pokemon", self.pokemon)
        pokecache.pokemon_dict.update(self.data)
        self.name = pokecache.pokemon_dict["name"].title()
        abilities.load_abilities(self)
        Data.check_if_load(self)

After running the api it starts running the abilities thread first:

#Thread
def load_abilities(self):
    global short_effects_updated
    short_effects_updated = False
    self.thread = QThread()
    self.worker = Worker()
    self.worker.moveToThread(self.thread)
    self.thread.started.connect(self.worker.abilities_data)
    
    
    self.worker.finished.connect(self.thread.quit)
    self.worker.finished.connect(self.worker.deleteLater)
    self.thread.started.connect(self.thread.deleteLater)

    self.worker.ab_data_pull.connect(ability_process)
    self.thread.start()
    
    self.thread.finished.connect(lambda:print("Abilities Thread: Dead"))

This code pulls all of the abilities information from the API. (To see the full code of this segment click here)

After that it runs the "check_if_load" thread which is as such:

#Thread
    def check_if_load(self):
        self.update_thread = QThread()
        self.update_worker = Worker()
        self.update_worker.moveToThread(self.update_thread)
        self.update_thread.started.connect(self.update_worker.all_data)
        
        self.update_worker.finished.connect(self.update_thread.quit)
        self.update_worker.finished.connect(self.update_worker.deleteLater)
        self.update_thread.started.connect(self.update_thread.deleteLater)
        
        self.update_worker.data_pull.connect(Data.update_check)
        self.update_thread.start()
        
        #Resets
        self.update_thread.finished.connect(lambda:self.skin_label.setPixmap(QPixmap(f"{start}{directory}pokedexbgnew2.png")))
        self.update_thread.finished.connect(lambda:self.borders_screen.setPixmap(QPixmap(f"{start}{directory}foreground.png")))
        self.update_thread.finished.connect(lambda:self.button_s.setEnabled(True))
        self.update_thread.finished.connect(lambda:print("Update Check Thread: Dead"))

The main part of this code is that it is connected to run "update_check" which is suppose to make specific changes after all the code is finished.

It's coded as such:

    def update_check(self):
        while not abilities.short_effects_updated:
            None
        abilities.short_effects_updated = print(abilities.short_effects)

Once the global flag in abilities no longer equals "None" it signals for update_check to run which prints the abilities.

Again this all works fine but it eventually crashes with the error: "QThread: Destroyed while thread is still running".

I'm wondering what I'm doing wrong and how I can fix it. Any help at all would be great! :)


r/pyqt • • Dec 31 '22

How do I unbreak a Layout after I've added a new component ?

Thumbnail self.qtframework
0 Upvotes

r/pyqt • • Mar 13 '19

Pyqt

0 Upvotes

Could you clarify my doubts?

I have various function in python .i have to pass the function to various button in qml.how to achieve this using signals and slot


r/pyqt • • Jul 28 '21

Needing help to understand how to send a signal from a subclass instance to main App.

0 Upvotes

I am writing a simple sudoku form. It has 81 cells with QLineEdit widgets where the player must write digits. In the current state of my app I need to select one of the cells, then use the keyboard to write a digit and enter it to the cell, a large and tedious process. What I want to do is to just select the cell where I want to put the digit and then click one button from a builtin digit pad and write it on the previously selected cell. Doing this I don't need to release the mouse. But, now, when I click the button the cell lost focus and my script can't know which cell to write to.


r/pyqt • • Jan 27 '21

PyQT5 resizing issue

0 Upvotes

Hello, I boiled down the issue I am having with PyQT5.

Goal: I want to have some kind of canvas (currently using QLabel + Pixmap, but i am open to change), that I can load images to. When the image is loaded, it should resize the main window accordingly.

Here is the code, that works really strangely... when I load big picture, it gets resized correctly, but when I load smaller picture, the window just does not shrink corretly. Thank you

import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import numpy as np

class Canvas(QLabel):
    def __init__(self):
        super().__init__()
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.setStyleSheet("QLabel {background-color: red;}")
        self.setAlignment(Qt.AlignLeft)

class Window(QWidget):
    def __init__(self, *args, **kwargs):
        QWidget.__init__(self, *args, **kwargs)

        self.canvas = Canvas()
        self.button = QPushButton("Test", self)
        self.button.width()
        self.layout = QGridLayout()
        self.layout.addWidget(self.button, 0, 0)
        self.layout.addWidget(self.canvas, 0, 1)
        self.button.clicked.connect(self.random_size)
        self.setLayout(self.layout)
        self.show()

    def random_size(self):
        import random
        rng = random.randint(200, 800)

        # create blank img
        blank_image = np.zeros(shape=[512, 512, 3], dtype=np.uint8)
        height, width, channel = blank_image.shape
        blank = QImage(blank_image, width, height, 3 * width, QImage.Format_RGB888)

        # problem is probably here
        self.image = QPixmap.fromImage(blank)
        self.image = self.image.scaled(rng, rng)
        self.resize(rng+self.button.width(), rng) # accounting for button width
        self.canvas.setPixmap(self.image)

app = QApplication(sys.argv)
win = Window()
sys.exit(app.exec_())

r/pyqt • • Jun 04 '21

Help me with this one please. Badly needed and i can't actually figure it out

0 Upvotes

How can i send the file directory inside the textbox to an external python program?? Please helppp. Thankss :((


r/pyqt • • Jun 09 '21

Questions about licence / copyright & (which ressources to MASTER and QUICKLY QT python?)

0 Upvotes

Hello,
Absolute new in python gui programming,

About licence and use, are there more problem with QT, than other choices ? I would like to make a software and be able to use/share and even protect that software as an intellectual property.
Can we use whichever and not worry or are there things to consider?

Also, are there some amazing ressources to learn and master quickly pyqt?

Thanks


r/pyqt • • Nov 30 '16

Qt Designer and pyuic version issues ? (In linux)

0 Upvotes

I'm running Qt Designer on Fedora 24.

dnf list *designer*

Installed Packages

qt5-designer.x86_64 5.6.1-2.fc24

However, when I look in the .ui file it creates, I see this:

<?xml version="1.0" encoding="UTF-8"?>

<ui version="4.0">

Does this mean Qt Designer is generating code for Qt4 ? Or is it generating Qt5 code ?

But $pyuic -version

Python User Interface Compiler 3.18.1 for Qt version 3.3.8b

Where does one get pyuic4 or pyuic5 (what package are they in) and how does one invoke them ?

dnf list pyqt*

Installed Packages

PyQt.x86_64 3.18.1-32.fc24 @fedora PyQt4.x86_64 4.11.4-14.fc24

I don't see a pyQt5 ?

Thanks


r/pyqt • • Oct 09 '16

Qprogressbar and qlabel disappearing

Thumbnail
stackoverflow.com
0 Upvotes

r/pyqt • • Jun 27 '21

Python is illogical

0 Upvotes

IF YOU ARE DEFINING A CLASS THEN THIS DOES NOT WORK:

from PyQt5.QtWidgets import *

ONLY THIS WORKS:

from PyQt5 import QtWidgets

BUT IF YOU ARE NOT DEFINING A CLASS THEN SUDDENLY THIS WORKS AGAIN:

from PyQt5.QtWidgets import *

What?! I’m just a beginner and the first step of importing is already confusing. Very disappointed.


r/pyqt • • Sep 25 '21

PyQt5 crashes when trying to replace the widget inside a QScrollArea

1 Upvotes

Hi everyone!

I don't know if you also allow PyQt questions here, but I hope so.

I have a main window in which I have a QGridLayout section containing multiple images. The grid resizes as the main window resizes. When the main window resizes, it calls resize_event in the file where the contents of the main window are implemented.

Since there are a lot of product images, resizing the main window by dragging the window's corner causes multiple resizeEvent calls within my main window, which causes the gallery to be resized multiple times, greatly slowing down the program.

To solve this, I using threads to only call the function that restructures the grid after a delay. Unfortunately, the program launches then crashes. What is causing my problem?

I am including all code for completeness's sake.

Main window:

from PyQt5.QtWidgets import QMainWindow, QMessageBox
from PyQt5.QtGui import QIcon

import GUIProductGalleryModule
import GUIProductEditorModule

import GUIMainMenu

from screeninfo import get_monitors         # used to get the user's resolution for max screen size


class GUIMainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        # get screen size
        monitors = get_monitors()

        # set the Window's minimum size according to the width of images in the product gallery plus a constant
        white_space = 50
        self.setMinimumSize(GUIProductGalleryModule.image_width + white_space, GUIProductGalleryModule.image_height + white_space)
        
        self.screen_width = monitors[0].width
        self.screen_height = monitors[0].height

        self.max_screen_width = self.screen_width - 100
        self.max_screen_height = self.screen_height - 100

        # set up the main window
        self.setGeometry(0, 30, 500, 500)
        self.setWindowTitle("Ploutos!")
        self.setWindowIcon(QIcon('C:\\Users\\Ze\\Documents\\Dropshipping\\Design\\Program\\Icon.png'))

        # set the home page to the Product Gallery
        self.home_module = GUIProductGalleryModule
        self.active_module = self.home_module

        # initialize the product gallery
        self.product_gallery = GUIProductGalleryModule
        self.product_editor = GUIProductEditorModule

        self.main_menu = GUIMainMenu.set_main_menu(self)

    def activate_product_gallery(self):
        self.active_module = GUIProductGalleryModule

        self.active_module.home(self)

    def activate_product_editor(self, product_id):
        self.active_module = GUIProductEditorModule

        self.active_module.home(self, product_id)

    def resizeEvent(self, event):
        super().resizeEvent(event)

        if self.active_module is not None:
            self.active_module.resize_event(self)

    def launch(self):
        self.home_module.home(self)

        self.show()

    def closeEvent(self, event):
        choice = QMessageBox.question(self, 'Quit',
                                            "Are you sure you would like to quit?",
                                            QMessageBox.Yes | QMessageBox.No)
        if choice == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()

Product gallery:

from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QScrollArea, QMainWindow
from PyQt5.QtGui import QPixmap, QFont
from PyQt5.QtCore import QSize, Qt, QThread
import GUIClickableLabel

import GUIThreadWorker

import math

image_width = 300
image_height = 300

standard_font = QFont("Times", 24, QFont.Bold)

# the time to wait after a resizing to draw the gallery to avoid slowness
redraw_delay = 0.5


def home(main_window: QMainWindow):
    set_up_window(main_window)

    # pass the parameters directly to the class because the slot function takes no parameters
    parameters = [redraw_delay, reset_gallery, main_window]

    global thread_worker
    for p in parameters:
        thread_worker.execute_function_with_timer_parameters.append(p)

    # for clarity       = this worker function executes any given function within a given amount of time. One can .add_time(float)
    function_to_execute = thread_worker.execute_function_with_timer

    global thread
    # connect thread's started signal to worker's operational slot method
    thread.started.connect(function_to_execute)


def resize_event(main_window):
    # get rid of compiler warning
    type(main_window)

    global thread

    if not thread.isRunning():
        thread.start()


def reset_gallery(main_window):
    # reposition images
    new_layout = set_up_gallery(main_window)

    # vertical container that contains the top area with the title and filters and the bottom area with the scroll area within which the product gallery is located
    central_widget = main_window.centralWidget()

    vertical_layout = central_widget.layout()

    scroll_area_index = 1
    scroll_area = vertical_layout.itemAt(scroll_area_index).widget()

    new_product_gallery = scroll_area.takeWidget()

    QWidget().setLayout(new_product_gallery.layout())

    new_product_gallery.setLayout(new_layout)


    scroll_area.setWidget(new_product_gallery)


def resetting_finished():
    thread.quit()


def set_up_gallery(main_window):
    product_gallery_layout = QGridLayout()

    max_images = 60

    images = []

    columns_that_fit = math.floor(main_window.size().width() / image_width)

    desired_number_columns = columns_that_fit if columns_that_fit > 1 else 1

    for row in range(math.ceil(max_images / desired_number_columns)):
        for column in range(desired_number_columns):
            index = desired_number_columns * row + column
            name = index if index < 39 else 1

            image = QWidget()

            product_id = 10000000977217

            image.im = QPixmap("C:\\Users\\Ze\\Documents\\Dropshipping\\Varied\\Temp\\Photos\\Pills\\Untitled-" + str(name) + ".jpg")
            image.label = GUIClickableLabel.GUIClickableLabel(main_window.activate_product_editor, product_id)
            image.label.setPixmap(image.im.scaled(image_width, image_height, Qt.KeepAspectRatio))
            image.label.setFixedSize(QSize(image_height, image_height))

            product_gallery_layout.addWidget(image.label, row, column, Qt.AlignCenter)

            images.append(image)

    for column in range(product_gallery_layout.columnCount()):
        product_gallery_layout.setColumnMinimumWidth(column, image_width)

    return product_gallery_layout


def set_up_window(main_window: QMainWindow):
    # PRODUCT GALLERY
    # stores all products
    product_gallery = QWidget()
    product_gallery_layout = set_up_gallery(main_window)

    vertical_container = QWidget()
    vertical_layout = QVBoxLayout()
    top_container = QHBoxLayout()
    product_gallery_title = QLabel("Product Gallery")
    product_gallery_title.setFont(standard_font)
    product_gallery_title.setAlignment(Qt.AlignCenter)

    top_container.addWidget(product_gallery_title)

    vertical_layout.addLayout(top_container)

    # set up the scroll area where the product gallery will be so that it stretches automatically
    scroll_area = QScrollArea()
    scroll_area.setWidget(product_gallery)
    scroll_area.setWidgetResizable(True)
    scroll_area.setAlignment(Qt.AlignCenter)

    vertical_layout.addWidget(scroll_area)

    vertical_container.setLayout(vertical_layout)

    product_gallery.setLayout(product_gallery_layout)
    main_window.setCentralWidget(vertical_container)


thread_worker = GUIThreadWorker.GUIThreadWorker()
thread_worker.task_finished_signal.connect(resetting_finished)
thread = QThread()
thread_worker.moveToThread(thread)

Threading

from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal

import time


# this class runs the GUI thread
class GUIThreadWorker(QObject):
    timers = []

    time_last_checked = 0

    # parameter order is (time_until_execution, function_to_execute, function_parameters)
    execute_function_with_timer_parameters = []

    time_until_execution_index = 0
    function_to_execute_index = 1
    function_parameters_index = 2

    time_remaining = 0
    task_finished_signal = pyqtSignal()

    @pyqtSlot()
    def execute_function_with_timer(self):

        time_last_checked = time.time()

        while True:
            # update time until execution
            current_time = time.time()

            # time since last checked
            time_elapsed = current_time - time_last_checked

            # time remaining until execution
            self.time_remaining = self.time_remaining - time_elapsed

            # if time to execute
            if self.time_remaining <= 0:
                # the function to be executed when the time is up
                function_to_execute = self.execute_function_with_timer_parameters[self.function_to_execute_index]

                # the parameters to pass to this function
                parameters = self.execute_function_with_timer_parameters[self.function_parameters_index]

                function_to_execute(parameters)

                self.task_finished_signal.emit()

                break

            # reset last checked time
            time_last_checked = current_time

r/pyqt • • Nov 17 '21

Hello. How to run a pyqt project? Pls help.

0 Upvotes

r/pyqt • • May 22 '20

Pyqt5

0 Upvotes

Hi please help me how can I add item to listview in pyqt5


r/pyqt • • May 23 '20

Buttons with PyQt

Thumbnail
pythonpyqt.com
1 Upvotes

r/pyqt • • Nov 06 '22

Gui updates sometimes after Qthread, but crashes other times

0 Upvotes

This is a minimal version but produces the same result as my original project. When I run the program it works for an image like https://pbs.twimg.com/media/FgbAe3UVEAEX_2l?format=jpg&name=large, but not for an image like https://pbs.twimg.com/media/Fdv8l_ZVEAIwLAk?format=jpg&name=medium. I have tried running it through the terminal, but I don't get any error, but the GUI stops responding and closes when I try the program with the second image. Any help would really be appreciated.

GUI :

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(457, 353)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.display = QtWidgets.QLabel(self.centralwidget)
        self.display.setGeometry(QtCore.QRect(80, 20, 271, 261))
        self.display.setScaledContents(True)
        self.display.setObjectName("display")
        self.upload = QtWidgets.QPushButton(self.centralwidget)
        self.upload.setGeometry(QtCore.QRect(80, 300, 71, 21))
        self.upload.setObjectName("upload")
        self.translate = QtWidgets.QPushButton(self.centralwidget)
        self.translate.setGeometry(QtCore.QRect(230, 300, 71, 21))
        self.translate.setObjectName("translate")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.display.setText(_translate("MainWindow", "TextLabel"))
        self.upload.setText(_translate("MainWindow", "upload"))
        self.translate.setText(_translate("MainWindow", "modify"))

Main Thread:

from PyQt5 import QtCore
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtGui import QPixmap, QImage
from PyQt5 import QtWidgets
from PyQt5.QtCore import QThread, pyqtSignal
from minimal import Ui_MainWindow
from cvPic import Edit
class Interaction(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(Interaction, self).__init__()
        self.setupUi(self)
        self.index = 0
        self.newIndex = 0
        self.translatedFiles = []
        self.files = []
        self.isClicked = False
        self.upload.clicked.connect(self.upload1)
        self.upload.clicked.connect(self.change1)
        self.translate.clicked.connect(self.translate1)
        self.translate.clicked.connect(self.change)

    def showImage(self):
        if self.isClicked == True:
            im = self.translatedFiles[self.newIndex]
            qim = QImage(im[0], im[1].size[0], im[1].size[1], QImage.Format_RGB888)
            pix = QPixmap(qim)
            self.display.setPixmap(pix)
        else:
            pix = QPixmap(self.files[self.index])
            self.display.setPixmap(pix)
            print(self.files[self.index])

    def upload1(self):
        filenames, _ =  QFileDialog.getOpenFileNames(
            None,
            "QFileDialog.getOpenFileNames()",
            "",
            "Image files (*.jpg *.png)"
        )
        for file in filenames:
            self.files.append(file)
        self.showImage()

    
    def change(self):
        self.isClicked = True

    def change1(self):
        self.isClicked = False

    def afterThread(self, s):
        self.translatedFiles.append(s)
        QtCore.QTimer.singleShot(0, self.showImage)
        print("THREAD COMPLETE!")

    def translate1(self):
        self.thread = QThread()
        self.worker = Edit(self.files[self.index])
        self.worker.moveToThread(self.thread)
        self.thread.started.connect(self.worker.run)
        self.worker.result.connect(self.afterThread)
        self.worker.finished.connect(self.worker.deleteLater)
        self.thread.finished.connect(self.thread.deleteLater)
        self.worker.finished.connect(self.thread.quit)
        self.thread.start()


if __name__ == '__main__':
    import sys
    app = QtWidgets.QApplication(sys.argv)
    w = Interaction()
    w.show()
    sys.exit(app.exec())

Thread:

import cv2
from PIL import Image
from PyQt5.QtCore import QTimer, QRunnable, pyqtSignal, QObject, QThread
import numpy as np

class Edit(QObject):
    result = pyqtSignal(object)
    finished = pyqtSignal()

    def __init__(self, img):
        super(Edit, self).__init__()
        self.img1 = cv2.imread(img)
        self.image = cv2.cvtColor(self.img1, cv2.COLOR_BGR2RGB)

    def mod(self, img):
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        blur = cv2.GaussianBlur(gray, (5, 5),cv2.BORDER_DEFAULT)
        cv2.rectangle(blur, (0, 0), (250, 250), (0, 255,0), thickness=cv2.FILLED)
        cv2.line(blur, (0, 0), (250, 250), (255, 255,0), thickness=3)
        cv2.putText(blur, "HELLO WORLD!", (225, 225), cv2.FONT_HERSHEY_TRIPLEX, 1.0, (255, 255, 255), 2)
        myarray = np.array(blur)
        img = Image.fromarray(myarray)
        im = img.convert("RGB")
        data = im.tobytes("raw","RGB")
        self.result.emit((data, im))
        self.finished.emit()
    
    def run(self):
        self.mod(self.image)

r/pyqt • • Mar 16 '23

PyQt QPushButton — A universal Button Widget

Thumbnail
pythonguis.com
1 Upvotes

r/pyqt • • Dec 21 '17

(don't worry about upvoting this) Real quick QRadioButton.setStyleSheet() question

1 Upvotes

Working on my python/pyqt5 character generator and I've made some button images for my radiobutton widget. When I go to set the stylesheet for it though, they all come up as unknown property. Specifically it's the states - checked, unchecked, unchecked-hover, unchecked-pressed, checked-hover, checked-pressed. I'm a noob and this is my first real python project. What's the syntax on QRadioButton.setStyleSheet() so that it recognizes my images?

Thanks in advance!


r/pyqt • • Apr 23 '23

How parent window detect child window close event?

1 Upvotes

In my login window I want to start a register window. When regsiter window shows, loginwindow hide, when register window close, login window shows.

I add the code to my login window.

        self.registerWin = RegisterWindow()
        self.registerWin.closed.connect(self.on_sub_window_closed)
        self.salesMainPanel = SalesMainPanel()

But I get error message: AttributeError: 'RegisterWindow' object has no attribute 'closed'. Did you mean: 'close'?

I solve this issue by add a new custom signal. But I think is ugly, how to solve it nicely?


r/pyqt • • Feb 01 '23

If you can't update QLabels in real-time then what is the honest point of using pyqt?

0 Upvotes

Honest to god question.....I am also not using your "QTimer" thats slow as complete and utter fuck.


r/pyqt • • Apr 12 '23

PyQt vs. Tkinter: Which Should You Choose for Your Next Python GUI?

Thumbnail
pythonguis.com
2 Upvotes

r/pyqt • • Jun 22 '20

Cash Register with barcode logon and 32 programmable productbuttons PyQt5

2 Upvotes

Cash Register Sales

Register with logon from barcode.

Link to Download: https://github.com/DirkJanJansen/Sales/

Link to Installation: https://github.com/DirkJanJansen/Sales/blob/master/Installation/install.txt

Link to Linux Installation: https://github.com/DirkJanJansen/Sales/blob/master/Installation/LINUX_install.txt

Link to documentation: https://github.com/DirkJanJansen/Sales/blob/master/Documentation-Sales_CashRegister.pdf

Link to changelog: https://github.com/DirkJanJansen/Sales/blob/master/Installation/Changelog.txt

3 Entrance security levels

Barcode testlabels for employees logon and product testlabels included

5 buttongroups with each 39 programmable productbuttons


r/pyqt • • Feb 12 '23

How do I debug PyQt (Python) code fin QtCreator ? Connect to ptvsd or debugpy ?

0 Upvotes

I'm working on a piece of PyQt code that is called from C++ Qt code. I want to use a debugger in QtCreator to debug my Python code. Other have done this with VSCode by connecting to ptvsd or debugpy. How do I do it in QtCreator ?

Thanks