pyqt5

Opening new window while out of focus using “keyboard”

会有一股神秘感。 提交于 2021-02-02 09:28:26
问题 I am trying to track my keypresses, using the module "keyboard" while a PySide2 Widget is not in focus, which works fine. However when I try to create a new Widget using a "keyboard" shortcut the program crashes. Opening a window on a button press works fine. I can also call non UI functions using "keyboard" eg. the print function without any problem. Do you know a way to fix this and open a new window using "keyboard" or any other method, while a PySide2 window is not in focus. In this

How to show progress bar while saving file to excel in python?

血红的双手。 提交于 2021-02-02 08:35:32
问题 Appreciate if you could help me. I have a trouble showing up the progress bar while saving file to excel. What I want to achieve is to show a progress bar while saving excel file from a pandas dataframe also from qwidgettable as it takes time before it saves. Until the excel file is downloaded or saved i want that progress bar to close. I tried looking over the net but I cant see specific answers to my query. So far, this is the compiled codes I have created. import sys from PyQt5 import

Run command with PyQt5 and getting the stdout and stderr

随声附和 提交于 2021-01-30 09:07:26
问题 I want to run command with PyQt5. And I want to get the stdout and stderr in time order and in real-time. I separated into UI class and Worker class. There are several UI classes, but for simplicity, I've specified just one. I've tried to solve this problem, but I can't. I can't connect between the Worker thread and logger function. test_ui.py import sys import subprocess from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout from PyQt5.QtWidgets import QPushButton,

Run command with PyQt5 and getting the stdout and stderr

无人久伴 提交于 2021-01-30 09:05:03
问题 I want to run command with PyQt5. And I want to get the stdout and stderr in time order and in real-time. I separated into UI class and Worker class. There are several UI classes, but for simplicity, I've specified just one. I've tried to solve this problem, but I can't. I can't connect between the Worker thread and logger function. test_ui.py import sys import subprocess from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout from PyQt5.QtWidgets import QPushButton,

QLabel is not updated unless the mainWindow is unfocused

依然范特西╮ 提交于 2021-01-29 22:34:12
问题 I am trying "Hello World" using PyQt5 with Python 3.7.3 and macOS 10.14.6. Executing pyqt_helloworld.py below and clicking the button will update the label to "Hello World". However, when the button is clicked, the text is not changed, and it is not until I focus on the window of other application manually that the label is updated. How can I update QLabel without unfocusing the PyQt application? Thanks in advance! pyqt_helloworld_ui.py from PyQt5 import QtCore, QtGui, QtWidgets class Ui

QLabel is not updated unless the mainWindow is unfocused

我与影子孤独终老i 提交于 2021-01-29 22:13:30
问题 I am trying "Hello World" using PyQt5 with Python 3.7.3 and macOS 10.14.6. Executing pyqt_helloworld.py below and clicking the button will update the label to "Hello World". However, when the button is clicked, the text is not changed, and it is not until I focus on the window of other application manually that the label is updated. How can I update QLabel without unfocusing the PyQt application? Thanks in advance! pyqt_helloworld_ui.py from PyQt5 import QtCore, QtGui, QtWidgets class Ui

QLabel is not updated unless the mainWindow is unfocused

て烟熏妆下的殇ゞ 提交于 2021-01-29 21:51:22
问题 I am trying "Hello World" using PyQt5 with Python 3.7.3 and macOS 10.14.6. Executing pyqt_helloworld.py below and clicking the button will update the label to "Hello World". However, when the button is clicked, the text is not changed, and it is not until I focus on the window of other application manually that the label is updated. How can I update QLabel without unfocusing the PyQt application? Thanks in advance! pyqt_helloworld_ui.py from PyQt5 import QtCore, QtGui, QtWidgets class Ui

matplotlib in second window pyqt5

心已入冬 提交于 2021-01-29 20:12:38
问题 I wish to plot a matplotlib graph in a second window when a button is clicked in the main window. Using https://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html , which plots a graph in the main window, I wrote the code below. The matplotlib graph is indeed plotted in a second window, but it has a very small size and I don't understand how to adjust the size of the graph to the window. May I have some help? from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication,

Qt: QPushButton vertical size, fit to contents?

谁都会走 提交于 2021-01-29 16:26:32
问题 Is there any way to reliably have a push button's height fit to its contents? Some previous answers suggest using layouts and size policies, or maximum height (How to make height of a QPushButton automatically fit the text?, Increase Height of QPushButton in PyQT, How can I set a QPushButton to grow vertically?), but they don't seem to work for me. See the example below. The two buttons are drawn with their default "one line" height, so the text inside is clipped. Setting their size policies

How can I make my PyQt5 app oney one instance?

梦想的初衷 提交于 2021-01-29 15:42:56
问题 What I want to achieve: when I run application from start menu, app starts (if app not running). If an app is already running, then don't create another instance, just show the previous running app window. What I've tried: created a .txt file in a directory, write ' running ' & ' not running ' into the file while opening & exiting the window. And checking the file contents at very start. For ex: When starting app: 1.) Check the file content, 2.) If file content is ' running ', show warning &