pyqt

how to paste and copy out multiple cells values in qt table widget

萝らか妹 提交于 2021-02-11 12:31:54
问题 I am very new in programming. Please help me in this regards. Thanks in advance. Here is my code: from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def clear_table(self): self.tableWidget_2.clearContents() def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1920, 1080) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.tableWidget_2 = QtWidgets.QTableWidget(self.centralwidget) self

Ensure that view shows scrollbar and adapts

核能气质少年 提交于 2021-02-11 12:07:55
问题 This is a follow-up question. Here is the link to my previous question. The answer there works but the problem however I faced was that in the beginning, the line would be drawn to the mouse press taking it as the endpoint instead of been drawn from the mouse press taking it as the starting point. As suggested by a user there explicitly setting the sceneRect solves the problem, but however after explicitly setting the sceneRect the view stops adapting and showing scrollbar. Here's a demo

Ensure that view shows scrollbar and adapts

杀马特。学长 韩版系。学妹 提交于 2021-02-11 12:07:52
问题 This is a follow-up question. Here is the link to my previous question. The answer there works but the problem however I faced was that in the beginning, the line would be drawn to the mouse press taking it as the endpoint instead of been drawn from the mouse press taking it as the starting point. As suggested by a user there explicitly setting the sceneRect solves the problem, but however after explicitly setting the sceneRect the view stops adapting and showing scrollbar. Here's a demo

用 Pyqt5 制作一个炫酷水波进度条

时光怂恿深爱的人放手 提交于 2021-02-11 11:39:08
提出需求 最近做了一个小项目,里面有一个需求需要添加一个动态进度条,进度条的样式就类似于水波来回起伏的那种形状,下面就是最初的展示效果(有一点区别,这里我加了一个进度自动增加的功能): 下面先说一下这个效果的制作原理 原理介绍 在介绍动态效果之前需要先看一下静态的: 如果仔细观察的话,静态图效果的呈现在于先后的两个线条的绘制,产生水波的主要是由于两线条的 左右的水平错位 以及 设置的透明度不同 所造成的; 想要形成最后的水波荡漾的视觉效果,只需要把数张线条连续走向的静态图拼接在一起就能达到 线条中的波浪效果,这里用到的是 正弦函数 的走向,教程代码中的两根线条主要借助于 y = Asin(wx+l)+k 函数 绘制 y = Asin(wx+l)+k 函数中,各参数的作用如下图所示 从图中我们可以了解到,两个线条就能实现交叉起伏的效果, 是因为两正弦函数中设置的 l 值不一样 , 基本原理讲解完了,下面就是代码实现部分,图像呈现效果是由 Qt 中的 QPellete(画板) 实现,图像中的线条区域主要用到了 QPainterPath() 函数,函数可以借助绘制的线条围城一个区域 动态图效果的实现主要是在代码中加入了一个 startTimer() 函数,起到计时器效果:每隔一定的时间就会更新一次界面(所得到的静态图也不一样,这个静态图的视觉差实现动态效果);

How can resources be provided in PyQt6 (which has no pyrcc)?

落花浮王杯 提交于 2021-02-11 06:51:12
问题 The documentation for PyQt6 states that Support for Qt’s resource system has been removed (i.e. there is no pyrcc6 ). In light of this, how should one provide resources for a PyQt6 application? 回答1: There has been some discussion on the PyQt mailing list when this was found out. The maintainer is not interested in maintaining pyrcc anymore as he believes that it doesn't provide any major benefit considering that python already uses multiple files anyway. The easiest solution is probably to

Iteration of a QTreeWidget

限于喜欢 提交于 2021-02-11 06:20:32
问题 I have a QTreeWidget that I am using to represent a breakdown structure of data. Basically I plan on using my QTreeWidget in a way to track the population of certain demographics in cities. For example: Males 9,000 - New York 5,000 - D.C. 4,000 Females 10,000 - Nashville 3,000 - San Diego 7,000 Obviously this data is just for example. A few problems I am having with implementing this. I can't figure out how to iterate over the tree. So that every so often I can check if the data has changed.

Iteration of a QTreeWidget

…衆ロ難τιáo~ 提交于 2021-02-11 06:20:18
问题 I have a QTreeWidget that I am using to represent a breakdown structure of data. Basically I plan on using my QTreeWidget in a way to track the population of certain demographics in cities. For example: Males 9,000 - New York 5,000 - D.C. 4,000 Females 10,000 - Nashville 3,000 - San Diego 7,000 Obviously this data is just for example. A few problems I am having with implementing this. I can't figure out how to iterate over the tree. So that every so often I can check if the data has changed.

Prevent tab cycling with Ctrl+Tab by default with QTabWidget

帅比萌擦擦* 提交于 2021-02-10 23:48:06
问题 I have the following example code that makes a three tab layout (with buttons on the third tab). By default, I can Ctrl + Tab / Ctrl + Shift + Tab to cycle between the tabs. How do I disable this functionality? In my non-example code, this is not desired behaviour. from PyQt4 import QtGui import sys def main(): app = QtGui.QApplication(sys.argv) tabs = QtGui.QTabWidget() push_button1 = QtGui.QPushButton("QPushButton 1") push_button2 = QtGui.QPushButton("QPushButton 2") tab1 = QtGui.QWidget()

Trouble in retrieving window size and widget size

南笙酒味 提交于 2021-02-10 23:27:59
问题 Here is the code for a camera surveillance system. In the configuration_page.py file I'm getting the size of the window as 100x30 despite using self.showMaximized() and resizeEvent() . The widgets present in it are also showing the size as 640x480 . I'm particularly interested in retrieving the size of a widget named self.mid_frame in CameraDisplay class present in config.py file. Earlier I was facing the same issue in dashboard.py file but I found a workaround by explicitly passing width and

access element from .ui

旧巷老猫 提交于 2021-02-10 20:27:26
问题 I have problem to access my button and label from my dialog.ui. I am using Python 3.x and QT Designer 5.x. from PyQt5 import uic, QtWidgets from PyQt5.QtWidgets import QApplication Form, Window = uic.loadUiType("dialog.ui") #load ui (GUI) file app = QApplication([]) #create a QApplication window = Window() form = Form() form.setupUi(window) def on_click(): # self.qlFreeText.text("hello") alert = QMessageBox() alert.setText("You clicked the button!") alert.exec_() class Ui(QtWidgets