pyqt

How to make QTableView refresh Background color after it loads data again

只愿长相守 提交于 2021-02-18 19:09:12
问题 i have the following doubt regarding QTableView , i have added some code that changes the row background depending on what string the dataframe contains on the last column. def data(self, index, role=Qt.DisplayRole): if index.isValid(): if role == Qt.BackgroundRole: if df.iloc[index.row(),5] == "Ready for QC": return QBrush(Qt.yellow) if df.iloc[index.row(),5] == "In Progress": return QBrush(Qt.green) if role == Qt.DisplayRole: return str(self._data.iloc[index.row(), index.column()]) return

How to make QTableView refresh Background color after it loads data again

﹥>﹥吖頭↗ 提交于 2021-02-18 19:07:38
问题 i have the following doubt regarding QTableView , i have added some code that changes the row background depending on what string the dataframe contains on the last column. def data(self, index, role=Qt.DisplayRole): if index.isValid(): if role == Qt.BackgroundRole: if df.iloc[index.row(),5] == "Ready for QC": return QBrush(Qt.yellow) if df.iloc[index.row(),5] == "In Progress": return QBrush(Qt.green) if role == Qt.DisplayRole: return str(self._data.iloc[index.row(), index.column()]) return

Is plug-in based approach considered good practice for GUI app development in PyQt?

我们两清 提交于 2021-02-18 18:57:30
问题 I'm thinking of using a plug-in based UI architecture to develop my PyQt project, i.e. create a skeleton main window which will dynamically load all the other UI components and these UI components will be made as PyQt plugins. Since I'm quite new to PyQt, I'm wondering if this is a good practice that people tend to follow in GUI app development. Any better alternative approaches are welcome! 回答1: A plugin based architecture is a very powerful way to design scalable, maintainable, extensible

Is plug-in based approach considered good practice for GUI app development in PyQt?

我是研究僧i 提交于 2021-02-18 18:57:22
问题 I'm thinking of using a plug-in based UI architecture to develop my PyQt project, i.e. create a skeleton main window which will dynamically load all the other UI components and these UI components will be made as PyQt plugins. Since I'm quite new to PyQt, I'm wondering if this is a good practice that people tend to follow in GUI app development. Any better alternative approaches are welcome! 回答1: A plugin based architecture is a very powerful way to design scalable, maintainable, extensible

AttributeError: 'MyMainWindow' object has no attribute 'pushButton'

江枫思渺然 提交于 2021-02-18 18:17:49
问题 Trying to proceed click button event in my code but got some issue. AttributeError: 'MyMainWindow' object has no attribute 'pushButton' Seems, like clicked event can`t find pushbutton from my subclass. Probably i did some mistakes in syntax, so really waiting for your help guys. Sorry if the question very banal, pyQt5 is simply new for me, trying to figure out in all of this. Here is my files. ui_main.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file '1.ui' # #

Python 学习日记 第一天

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 01:49:49
日常鸡汤:   当你去想要去放纵自己的时候,多想想你的父母在干什么! 一、Python简介: 都说“Hello,Wolrd”是万恶之起源,但我觉得介绍才是万恶的起源。 Python 创始人龟叔(Guido van Rossum) 1.主要应用的领域: 云计算:OpenStack WEB开发:Django等框架 科学运算、人工智能:典型库NumPy等 系统运维 金融:量化交易,金融分析 图形GUI:PyQT等 2.编译和解释的区别: 编译器 是把源程序的每一条语句都编译成机器语言,并保存成二进制文件,这样运行时计算机可以直接以机器语言来运行此程序,速度很快。 解释器 是在执行程序时,才一条一条的解释解释成机器语言给计算机来执行,所以运算速度慢,跨平台性高 3.Python语言的特点:   “优雅”、“明确”、“简单”   并且Python是一门解释型的弱类型语言 二、第一个Python程序 1 # _*_ encoding:utf-8 _*_ 2 print ( " Hello,Word " ) frist   当python的版本为2系列的时候需要在编辑代码前加上一行 # _*_ encoding:utf-8 _*_   因为Python2系列的版本默认不支持utf-8的编码,python3 系列没有这个问题 三、变量 1.常量:   在python中不存在绝对的常量,只是约定俗称

how to return a variable from another window in pyqt?

风格不统一 提交于 2021-02-17 06:52:07
问题 I have one main window and one dialog in PYQT. I receive the input from user in main window and then open the dialog window and pass the input to this window. in dialog window again I receive another input and add this new input with the other input which I passed form main window. class MainWindow (QMainWindow): def __init__(self): super().__init__() self.window=Ui_MainWindow() self.window.setupUi(self) def open_qdialog_window(self): self.dialog_window = Qdialog(self.window.lineedit1

How to get function to run at specyfic time using python and PyQt not using Cron

依然范特西╮ 提交于 2021-02-17 06:13:05
问题 I'm creating RSS app in PyQt and I'm trying to find a good way to program updates. I found this Executing periodic actions in Python but maybe there is Qt specific way to do this things. I know update period for each feed so I want to run update at specific time(hh:mm). Making 10 minute loop that will check current time and run a update if its grater than next predicted feed update seems missing the point of knowing specific time to run it. 回答1: You should use QTimer in Qt applications.

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