pyqt5

How to implement zooming image better?

只愿长相守 提交于 2021-02-04 08:22:15
问题 I have the following code: from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QGroupBox, QLabel from PyQt5.QtGui import QPixmap from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt import sys class Window(QWidget): def __init__(self): super().__init__() self.imgLabel = QLabel(self) pixmap = QPixmap("feedreader.jpg") self.imgLabel.setPixmap(pixmap) self.imgLabel.setAlignment(Qt.AlignCenter | Qt.AlignCenter) self.imgLabel.setSizePolicy

Use Dash (plot.ly) in PyQt5 GUI

核能气质少年 提交于 2021-02-04 07:53:21
问题 I am running into a problem while trying to create a dashboard with Dash (plotly), while using a GUI created with PyQt5. I have tried to have the following example code both as a module and at the end of my code: import dash import dash_core_components as dcc import dash_html_components as html def run_dash(data, layout): app = dash.Dash() app.layout = html.Div(children=[ html.H1(children='Hello Dash'), html.Div(children=''' Dash: A web application framework for Python. '''), dcc.Graph( id=

How to add video in UI created using Qt Designer with a promoted widget which is a QVideoWidget?

流过昼夜 提交于 2021-02-04 06:36:50
问题 I am a beginner in Qt. But following some tutorials I created a UI in qt designer which would display a live stream video. I have read that in order to add video i need to promote widget to a QVideoWidget. Then I convert the .ui to a .py file to access it using python language. The thing is once i have done that i dont know how to put the video in the widget that i made in the ui. Thank you. The code below show the GUI.py file. I am importing it in another file where I would code it show the

How to add video in UI created using Qt Designer with a promoted widget which is a QVideoWidget?

青春壹個敷衍的年華 提交于 2021-02-04 06:35:28
问题 I am a beginner in Qt. But following some tutorials I created a UI in qt designer which would display a live stream video. I have read that in order to add video i need to promote widget to a QVideoWidget. Then I convert the .ui to a .py file to access it using python language. The thing is once i have done that i dont know how to put the video in the widget that i made in the ui. Thank you. The code below show the GUI.py file. I am importing it in another file where I would code it show the

PyQt QtWebChannel: calling Python function from JavaScript

强颜欢笑 提交于 2021-02-04 04:49:55
问题 I am trying, using Qt classes QWebEngineView , and QWebChannel to make a simple connection between HTML page and Python script. The goal is simply to execute foo() when the header <h2> is clicked. import sys from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QApplication from PyQt5.QtWebChannel import QWebChannel from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage html = ''' <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <script src="qrc:///qtwebchannel

PyQt QToolButton not updating icon when in focus

删除回忆录丶 提交于 2021-02-02 10:12:08
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

PyQt QToolButton not updating icon when in focus

二次信任 提交于 2021-02-02 10:03:55
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

PyQt QToolButton not updating icon when in focus

别等时光非礼了梦想. 提交于 2021-02-02 10:03:34
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

PyQt QToolButton not updating icon when in focus

孤者浪人 提交于 2021-02-02 10:03:02
问题 I'm having a problem updating the icon of a button set with QToolButton . The idea is to use the button for a movie player. To play, one presses the button and the icon changes to pause. When pressed again, play is paused and the icon reverts to play. I have some working code, but the problem is that the icon is not updating consistently. If I keep the Qt window in focus, it takes one or two button presses to change the icon to the intended image, by which time the actual image is not the

Trying to take a value from a dictionary of a ComboBox and instert the key in a textEdit

。_饼干妹妹 提交于 2021-02-02 09:55:18
问题 I have a dictionary and a ComboBox that shows dictionary's values, i need to print in a textEdit the key of the dictionary's value chosen by the user. Here's my code. import sys from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QApplication, QDialog, QMainWindow from PyQt5.uic import loadUi from math import pi class MainPage(QMainWindow): classi = {None : None, "C25/30" : float(14.17), "C28/35" : float(15.87), "C32/40" : float(18.13), "C35/45" : float(19.83), "C40/50" : float(22.6