pyqt

How to hide the Main window(parent) from pop up window in PyQt5.?

让人想犯罪 __ 提交于 2021-02-11 14:47:14
问题 I have a Main window from where I am calling Waiver window(popup). On clicking OK on Waiver popup, I want to close the Waiver pop up and hide the Main window. I have included self.parent().hide in waiver pop up but its throwing error "Process finished with exit code 1073741845" . The pop up closes and the main window terminates abruptly. waiver_window.py from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import Qt, QSize, QRect class popup_on_waiver(QMainWindow): def _

PyQt5 QFileDialog closes when filename clicked

冷暖自知 提交于 2021-02-11 14:24:02
问题 I am using PyQt5 QFileDialog.getOpenFileName . I am expecting the box to remain open until the "open" button is clicked. However, when I run the code on my Linux system, the dialog box closes immediately when the file name is clicked. On a Windows system, the box behaves as expected and remains open until the 'Open' button is clicked. The results are the same with or without the QFileDialog.DontUseNativeDialog option set. from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton,

How would I go about making a overlay widget

故事扮演 提交于 2021-02-11 13:02:49
问题 How would I go about making a overlay widget with qt? I've considered using a QPaintEvent or a QGraphicsScene, but I want to be able to add widgets and for the widget to not occupy space in a layout, causing other widgets to shift when the popup appears. 回答1: I believe the best solution is to parent the so called overlay widget to the window or even have the overlay widget be in its own window. The first solution might be easier to do, but the overlay widget is bound to the inside of the

How would I go about making a overlay widget

人走茶凉 提交于 2021-02-11 13:01:42
问题 How would I go about making a overlay widget with qt? I've considered using a QPaintEvent or a QGraphicsScene, but I want to be able to add widgets and for the widget to not occupy space in a layout, causing other widgets to shift when the popup appears. 回答1: I believe the best solution is to parent the so called overlay widget to the window or even have the overlay widget be in its own window. The first solution might be easier to do, but the overlay widget is bound to the inside of the

PyQt4 QInputDialog and QMessageBox window flags

守給你的承諾、 提交于 2021-02-11 12:53:29
问题 I am using python 2.7 and PyQt4 to make a gui; my experience is pretty limited. I wanted to use the QInputDialog and QMessageBox objects for some of the dialogs I need. I don't want to have the "?" in any dialogs I use. There is an answer posted on how to do this for a similar question How can I hide/delete the "?" help button on the "title bar" of a Qt Dialog? That solution works for a standard QDialog. It amounts to: message = QtGui.QDialog(self, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt

pyqt5的简单进度条程序

为君一笑 提交于 2021-02-11 12:46:11
# -*- coding: utf-8 -*- # @Author : FELIX # @Date : 2018/5/17 16:43 from PyQt5.QtCore import QBasicTimer from PyQt5.QtWidgets import QApplication, QWidget, QProgressBar, QPushButton from PyQt5.QtGui import QIcon import sys class MyQt(QWidget): def __init__ (self): super(MyQt, self). __init__ () self.initUI() def initUI(self): # 构建一个进度条 self.pbar = QProgressBar(self) # 从左上角30-50的界面,显示一个200*25的界面 self.pbar.setGeometry(30, 50, 200, 25) # 设置进度条的位置 # 设置开始按钮 self.btn = QPushButton( ' 开始 ' , self) self.btn.move( 50, 90) # 按钮移动的位置 # 点击按钮 # 信号函数不能加括号 self.btn.clicked.connect(self.doAction) # 构建一个计时器

Implement a cancel button with Qt in python

自闭症网瘾萝莉.ら 提交于 2021-02-11 12:41:50
问题 This question is probably dumb, but to give some background: I have been given a bunch of code of a software whose GUI is written in Qt, and I have been told that I should improve it by implement multithreading so the interface doesn't freeze (I have a bunch of code written like that that I am using as a template). I am not familiar with Qt or GUIs in general. ATM I am trying to implement a simple cancel button: as the process in the background might take long, I want to be able to stop it

plot doesn't update on button click but does when window resized

穿精又带淫゛_ 提交于 2021-02-11 12:35:08
问题 What's going on: Program in python3/qt5/matplotlib. I am plotting three subplots and few plots in each. I wanted to update plots if user changes any data. That proved rather complicated hence the button 'Replot'. It calls a function that clears canvas and ... reloads the entire widget. It doesn't work as expected: when I press the button nothing happens, but when window gets resized after button clicked it does update the plot. What would be a correct way to do it without having to put all

plot doesn't update on button click but does when window resized

纵饮孤独 提交于 2021-02-11 12:34:09
问题 What's going on: Program in python3/qt5/matplotlib. I am plotting three subplots and few plots in each. I wanted to update plots if user changes any data. That proved rather complicated hence the button 'Replot'. It calls a function that clears canvas and ... reloads the entire widget. It doesn't work as expected: when I press the button nothing happens, but when window gets resized after button clicked it does update the plot. What would be a correct way to do it without having to put all

How to have two widgets in one Main window

孤街浪徒 提交于 2021-02-11 12:32:24
问题 I am trying the whole morning already to fix that. So I have a PyQt Main Window where I want to display two widgets. In the first widget there are articles listed (which works so far). When I click on them until now a QMessageBox is opening, but I want that a second widget is opening where I can read the RSS Feed. But this is not working. See Code below: class ArticleWidgets(QWidget): def __init__(self, *args): super().__init__(*args) self.setGeometry(610, 610, 600, 600) self.initUi() def