pyqt5

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 pass changing/updating data to another pop-up window?

僤鯓⒐⒋嵵緔 提交于 2021-02-11 17:36:02
问题 I got the following code for Python GUI. I found I cannot update the data running in the main window to the pop-up window. In this example I use some random data to mimic the video frames and use a timer to update the data (the updateData() funciton). I want to see the green curve in the pop-up window changes... But I cannot find an effective way to pass the changing data to the pop-up window. Should I use the pyqtSignal() to define a custom signal? I read this page. Should I define the

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

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 QRegularExpression can be passed to Qt::MatchRegularExpression

时间秒杀一切 提交于 2021-02-11 14:18:32
问题 I am trying this sample code that I found which is really really good. I am also trying to figure out the same thing to find an item and scroll to it, but this time I wanted to match the the string which has the EXACT WORD "cat" . Example matches: cat tom cat dog and cat super cat To make it very simple I am just trying to match an exact word in a string. Take this sample code as an example: import re s= "1 tom cat" s2 = "2 thundercat" if re.search(r'\bcat\b',s2): print("There is an EXACT

PyQt5: How to Re-Dock back a floated QDockWidget via a QPushButton?

此生再无相见时 提交于 2021-02-11 14:10:51
问题 I which to bring back to initial state an Undocked or floated QDockWidget with a QPushButton. from PyQt5 import QtCore, QtGui, QtWidgets class Mainwindow(object): def setupUi(self, window): window.setObjectName("window") window.resize(309, 148) self.centralwidget = QtWidgets.QWidget(window) self.centralwidget.setObjectName("centralwidget") self.Undock_btn = QtWidgets.QPushButton(self.centralwidget) self.Undock_btn.setGeometry(QtCore.QRect(4, 4, 100, 22)) self.Undock_btn.setStyleSheet(

how to send incoming messages from socket client to GUI (pyqt5)

喜夏-厌秋 提交于 2021-02-11 13:59:56
问题 I am trying to make a chat application using socket library. I have three files server.py , client.py and gui.py listening process for client and server are provided by infinite loops. because of that server.py runs in another terminal window. but client and gui are running in one terminal window. the problem is when I call functions containing infinite loop it stuck there and the rest of code won't run. I even tried using multiprocessing , threading.Thread , threading.Timer , QThread and

Draw over image in a QLabel with PyQt5

心已入冬 提交于 2021-02-11 13:40:59
问题 I want to draw over image with my mouse. I simplified the problem by this code. When i uncomment the line 31 the code doesn't work. My goal is to draw over the image i want to select from my PC and save the image after modify it. from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(QtWidgets.QMainWindow): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(581, 463) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget