pyqt5

Resize Tabs from QTabWidget to Content [duplicate]

折月煮酒 提交于 2021-02-17 06:46:27
问题 This question already has an answer here : Resize QMainWindow to minimal size after content of layout changes (1 answer) Closed 12 days ago . I'm using QTabWidget to show content with different sizes. How do I resize my tabs in a way that it matches my content? Goal: Tab1: Tab2: I tried to write a function that connects to QTabWidget.currentChanged(), I managed to ignore QSizePolicy, but the resize doesn't come into effect. I can however resize manually without problem. import sys from PyQt5

Can't install PyQt5 On Raspberry pi

隐身守侯 提交于 2021-02-17 06:36:25
问题 I can't seem to install PyQt5 on raspberry pi using: sudo python3 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org pyqt5 . I just have ran out of ideas and am asking here, as i've never seen this error before and i've install PyQt5 the same way on Ubuntu 18.04 with the exact same command and it worked. I have installed countless other packages with the above command and all have been successfull but PyQt5 just doesn't seem to install,

Drawing straight line between two points using QPainterPath

我的梦境 提交于 2021-02-17 06:06:53
问题 I have a scene where I would like to draw a line between two points(mouse press should be the start point and mouse release as the endpoint) using the QPainterpath. Here is a demonstration of how I want it to be. Here is what's happening with my current code. Below is the code I have tried import sys from PyQt5 import QtWidgets, QtCore, QtGui class Scene(QtWidgets.QGraphicsScene): def __init__(self, *args, **kwargs): super(Scene, self).__init__(*args, **kwargs) self.point = QtCore.QPointF(0.0

Drawing straight line between two points using QPainterPath

杀马特。学长 韩版系。学妹 提交于 2021-02-17 06:05:41
问题 I have a scene where I would like to draw a line between two points(mouse press should be the start point and mouse release as the endpoint) using the QPainterpath. Here is a demonstration of how I want it to be. Here is what's happening with my current code. Below is the code I have tried import sys from PyQt5 import QtWidgets, QtCore, QtGui class Scene(QtWidgets.QGraphicsScene): def __init__(self, *args, **kwargs): super(Scene, self).__init__(*args, **kwargs) self.point = QtCore.QPointF(0.0

Change combobox option to modificate graphic/chart

自闭症网瘾萝莉.ら 提交于 2021-02-17 05:16:21
问题 I'm using PyQt5 to build up a user interface to show up data from "curve_fit" method. As the data which I'm working can have discontinuities, my return from the method is divided on curve slices. My GUI is composed by two graphs and one combo box. The function of the combo box is to enable the user to choose which slice the chart will show. Although the event of the combo box is working, my charts still the same, without any modification. main.py import sys from PyQt5 import QtWidgets import

how to get user input from qdateEdit and select it from database in postgres

夙愿已清 提交于 2021-02-17 04:00:32
问题 i want to know how to get the user input in QDateEdit and select it in a table in postgres? here is my code def date(self): try: date = self.dateEdit.date() print(date) conn = psycopg2.connect(dbname="sample", user="postgres", password="admin", host="localhost", port="5432") cur = conn.cursor() cur.execute("SELECT * FROM data WHERE stdate = '%s'",date) result = cur.fetchall() self.tableWidget.setRowCount(0) for row_number, row_data in enumerate(result): self.tableWidget.insertRow(row_number)

travis with pytest-qt fails without exiting nor creating QmessageBox

▼魔方 西西 提交于 2021-02-17 03:57:52
问题 The context I try to create an integration test for an graphical user interface (GUI) written with Qt5 through python3 (so using pyqt5 ). And I use pytest with the plugging pytest-qt to test the GUI. I test the GUI which here is largely inspired from this question, so the command pytest -v -s runs well. Since my repository is on Github , I use Travis-CI to perform my integration tests. The error However when I push on Github and so I launch the Travis tests I get at some point the following

Emiting QTableWidgetItem specific signal on being clicked

China☆狼群 提交于 2021-02-17 02:52:06
问题 I want to implement the functionality that multiple QTableWidgetItems inside of a QTableWidget can be selected and unselected so that the values and "positions" of those QTableWidgetItems is known for further use. Inside of the QTableWidget there are some empty cells, for aesthetics/spacing, which should be ignored by the functionality I'm trying to implement. But that could also easily be done afterwards by checking if a selected item does have content. self.table_widget.itemClicked.connect

mouse release event on entire screen

痞子三分冷 提交于 2021-02-17 02:48:46
问题 I have a pyqt widget that is shown over all windows when launched. I need it to keep unclosed until user decides to. Is that possible to catch mouse release event every time mouseclick performed no matter where it was done: inside QtWidget window or outside of it? Here is a sample I use: class Release_check(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.canvas = iface.mapCanvas() self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)

label text is not updated but only last line updated the label in pyqt5

Deadly 提交于 2021-02-17 01:59:42
问题 I am making a project on pyqt5. now, its work is to click on one button "Click and Say" which call speech function in which label is updating and we say and it recognize it. the code is here. from PyQt5 import QtCore, QtGui, QtWidgets import urllib import speech_recognition as sr import time def connected(host='http://google.com'): try: urllib.request.urlopen(host) return True except: return False class Ui_Function(object): def setupUi(self, Function): Function.setObjectName("Function")