pyqt

KeyEvent in MainWindow (PyQt4)

时光总嘲笑我的痴心妄想 提交于 2021-02-16 11:35:34
问题 I'm trying to to build a GUI with PyQt4 and control some actions with the arrow keys. Nevertheless I fail to get the keystrokes. It have to be a simple issue, but I newbie to this. So any help will be appreciated. Thanks! import sys from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(910, 500) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8(

Can't select entire row of data from QTableWidget

╄→гoц情女王★ 提交于 2021-02-13 17:34:47
问题 Problem Statement I'm trying to select rows of data from my QtableWidget and print them out to my console just so I can test some things, with the end goal being able to plot the data. However I can never grab the whole row of data. Background I have made a GUI that can embed several QTableWidgets by importing a specifically formatted CSV file. The goal is to be able to pull data from multiple rows from the same or different tables and then plot them in a side by side fashion. Where each row

Can't select entire row of data from QTableWidget

。_饼干妹妹 提交于 2021-02-13 17:32:10
问题 Problem Statement I'm trying to select rows of data from my QtableWidget and print them out to my console just so I can test some things, with the end goal being able to plot the data. However I can never grab the whole row of data. Background I have made a GUI that can embed several QTableWidgets by importing a specifically formatted CSV file. The goal is to be able to pull data from multiple rows from the same or different tables and then plot them in a side by side fashion. Where each row

Can't select entire row of data from QTableWidget

喜欢而已 提交于 2021-02-13 17:32:00
问题 Problem Statement I'm trying to select rows of data from my QtableWidget and print them out to my console just so I can test some things, with the end goal being able to plot the data. However I can never grab the whole row of data. Background I have made a GUI that can embed several QTableWidgets by importing a specifically formatted CSV file. The goal is to be able to pull data from multiple rows from the same or different tables and then plot them in a side by side fashion. Where each row

Python高级进阶#015 pyqt5进度条QProgressBar结合使用qbasictimer

故事扮演 提交于 2021-02-13 05:03:44
本期GUI界面,我们继续学习新的控件Qprogressbar。 知识回顾 1.滑动控件qslider 控件设置的关键:设置最大值、最小值,绝对范围。 2.核心类库QtCore,枚举类Qt 核心枚举类的使用,可以帮助我们对代码的理解。 一、进度条的使用思想 进度条qprogressbar 使用思想: 1.载入类库 2.初始化类对象 3.设置最小值和最大值 4.时钟的使用QBasicTimer,槽方法对应类库的timerEvent 5.判断什么时候停止加载进度条 这里我们在学习使用进度条的时候,必须要结合使用时钟控件,这样才能让我们看到进度条动的感觉。 二、制作案例 说明如下: 1.界面由进度条和按钮组成 2.进度条的值范围为0~100 3.按钮的状态为“开始”、“停止”、“完成” 4..按钮需要能够控制进度条的运行 三、开发过程知识点介绍 1.导入时钟类 from PyQt5.QtCore import QBasicTimer 2.初始化进度条 self.pgb=QProgressBar(self) 类对象的初始化 self.pgb.move(50,50) 将进度条移动到指定位置 self.pgb.resize(300,20) 设置进度条宽高 3.设置进度条的范围 #设置进度条的范围 self.pgb.setMinimum(0) self.pgb.setMaximum(100)

九、Pyqt5进度条——QProgressBar

左心房为你撑大大i 提交于 2021-02-13 03:53:04
QProgressBar部件为进度条,进度条方向为水平或者竖直。在处理一个耗时较长的任务时,可能就会用到进度条部件。因为使用进度条可以形象告诉用户当前的任务正在进行中。 进度条常用函数如下: 函数 值 内容 setInvertedAppearance True/False 设置进度条的走向。 Ture:从左至右或从上到下 False:从右至左或从下到上 默认为True setOrientation Qt.Horizontal/ Qt.Vertical 设置进度条为水平、竖直。 默认为水平 setMinimum 0~99 设置最小值 ,默认0 setMinimum 0~99 设置最大值 ,默认99 setFormat %p %v %m 设置进度条旁的文本显示: 以百分比表示; 以当前值表示; 以总步长表示。 默认为百分比(%p)。 示例如下: 1 import sys,time 2 from PyQt5.QtWidgets import QApplication, QWidget, QProgressBar, QPushButton,QVBoxLayout 3 from PyQt5.QtCore import Qt 4 5 6 class Mywin(QWidget): 7 def __init__ (self): 8 super(). __init__ () 9 self

discord.py-rewrite - Dynamic Web Scraping using PyQt5 not working properly

末鹿安然 提交于 2021-02-11 18:10:20
问题 In short, I'm making a discord bot that downloads the "World of the Day" picture in the website https://growtopiagame.com as D:\Kelbot/render.png and then sends the picture to the channel the command was called. However, it is not a static website and the URL is not in the source code, so I found a solution that uses PyQt5: import re import bs4 as bs import sys import urllib.request from PyQt5.QtWebEngineWidgets import QWebEnginePage from PyQt5.QtWidgets import QApplication from PyQt5.QtCore

Make QGroupBox selectable and clickable

懵懂的女人 提交于 2021-02-11 17:52:25
问题 I have the following toy interface: from PyQt5 import QtWidgets, QtGui, QtCore class MainWindow(QtWidgets.QMainWindow): def __init__(self): super(MainWindow, self).__init__() w = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout() w.setLayout(layout) self.setCentralWidget(w) my_tree = QtWidgets.QTreeWidget() layout.addWidget(my_tree) alpha = QtWidgets.QTreeWidgetItem(my_tree, ['Alpha']) beta = QtWidgets.QTreeWidgetItem(my_tree, ['Beta']) alpha.addChild(QtWidgets.QTreeWidgetItem(['one']))

How to get selected items from QComboBox to be displayed in QTableWidget in PyQt5? (QComboBox has checkbox to pick items)

时间秒杀一切 提交于 2021-02-11 17:19:45
问题 I have QTableWidget in which I have QComboBox in each row for particular column. My each QCombobox has multiple values with checkboxes. I want to display selected item/s from each combobox in the next respective column 'SelectedMonths' in the same row and remove them when unchecked (Vice-versa). Until now I have Script ready which gives me what all items have been checked/unchecked but I dont know how to get the index of the row for which combobox is activated. Snippet to get the workflow

resizeEvent doesn't work if I use QUiLoader for QMainWindow

萝らか妹 提交于 2021-02-11 14:57:28
问题 I load main window from ui file: main_1.py from PySide import QtCore, QtGui, QtUiTools import sys class ControlMainWindow(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) loader = QtUiTools.QUiLoader() file = QtCore.QFile("lat.ui") file.open(QtCore.QFile.ReadOnly) self.ui = loader.load(file) file.close def show(self): self.ui.show() def resizeEvent(self, event): print event app = QtGui.QApplication(sys.argv) MW = ControlMainWindow() MW.show() sys