pyqt4

Mouse coordinates of pytqt graph line

流过昼夜 提交于 2021-02-07 20:28:15
问题 I am trying to get the (x,y) values of my random function plot whenever I move the moused on top of the graph. I am using pyqtgraph.SignalProxy and connect it to a callback mousedMoved. I am getting this as error: NameError: global name 'mouseMoved' is not defined Here is the code: import sys from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg import time import random class TestClass(QtGui.QMainWindow): ##################################################### def _

How to make the actual table adjust its size to the QTableWidget container?

末鹿安然 提交于 2021-02-07 20:24:00
问题 I do not even know how to ask this question. I have the following table: You can see how the QTableWidget is selected, but the actual table is smaller. How can I make the table to be the same size of the QTableWidget container? I am using QT-Designer. Thanks! 回答1: from Qt Designer there are horizontalHeaderStretchLastSection and verticalHeaderStretchLastSection properties on QTableWidget. 来源: https://stackoverflow.com/questions/13689184/how-to-make-the-actual-table-adjust-its-size-to-the

How to get rid of “Command Line” window when running Python script with GUI? [duplicate]

让人想犯罪 __ 提交于 2021-02-07 18:38:44
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How can I hide the console window in a PyQt app running on Windows? I am programming under Python2.6 + PyQT + Eric4 environment. All the GUI and Program parts are done, but here is the problem. When I run my program, two windows pop up. One is the window (or frame) I want, the other is like a python interpretor window having a all black undergroud color. And I really don't want this to show. What can I do to get

Pass extra arguments to PyQt slot without losing default signal arguments

孤人 提交于 2021-02-05 20:29:22
问题 A PyQt button event can be connected in the normal way to a function so that the function receives the default signal arguments (in this case the button checked state): def connections(self): my_button.clicked.connect(self.on_button) def on_button(self, checked): print checked # prints "True" Or, the default signal arguments can be overridden using lambda : def connections(self): my_button.clicked.connect(lambda: self.on_button('hi')) def on_button(self, message): print message # prints "hi"

The PyQt button does not show up

随声附和 提交于 2021-02-05 11:25:42
问题 So....I am using the PyQt lib for python to make a Graphics class which abstracts away most of the features of the QtGui class.I"ll be using it later for my other projects.This seems to be working fine,except that the button and the other widgets do not show up,although the window gets created. import sys from PyQt4 import QtGui class Graphics: def __init__(self): self.app=QtGui.QApplication(sys.argv) self.widgets={} self.labels={} self.buttons={} def getApp(self): return self.app def

multi inherit from QObject and QRunnable error

ぐ巨炮叔叔 提交于 2021-02-05 06:10:35
问题 I'm using pyqt4. I have a class multi inherited from QObject and QRunnable like this: class DownloadTask(QObject, QRunnable): def __init__(self): QObject.__init__(self) QRunnable.__init__(self) self.setAutoDelete(False) When an instance of DownloadTask is initializing, the last line throws exception: TypeError: could not convert 'DownloadTask' to 'QRunnable' But I think it is correct in grammer, QRunnable has the method setAutoDelete. Why can't it convert to QRunnable? Update: I intend to use

multi inherit from QObject and QRunnable error

久未见 提交于 2021-02-05 06:06:11
问题 I'm using pyqt4. I have a class multi inherited from QObject and QRunnable like this: class DownloadTask(QObject, QRunnable): def __init__(self): QObject.__init__(self) QRunnable.__init__(self) self.setAutoDelete(False) When an instance of DownloadTask is initializing, the last line throws exception: TypeError: could not convert 'DownloadTask' to 'QRunnable' But I think it is correct in grammer, QRunnable has the method setAutoDelete. Why can't it convert to QRunnable? Update: I intend to use

Displaying other language characters in PyQt

可紊 提交于 2021-02-04 16:47:43
问题 Is there a way to display other language characters in PyQt4? and if there is, what's the approach/direction that I should take? Thanks in advance. 回答1: Qt uses Unicode and should be able to display (Unicode) text in any language you have a suitable font for. For example, Roberto Alesina's simple "Hello World" program on the PyQt Wiki -- which I transcribe for readability (and w/o the comments for brevity) since it's pretty unreadable in the wiki -- should let you use as the button's text any

Displaying other language characters in PyQt

自古美人都是妖i 提交于 2021-02-04 16:47:19
问题 Is there a way to display other language characters in PyQt4? and if there is, what's the approach/direction that I should take? Thanks in advance. 回答1: Qt uses Unicode and should be able to display (Unicode) text in any language you have a suitable font for. For example, Roberto Alesina's simple "Hello World" program on the PyQt Wiki -- which I transcribe for readability (and w/o the comments for brevity) since it's pretty unreadable in the wiki -- should let you use as the button's text any

Adding items to QlistView

↘锁芯ラ 提交于 2021-02-04 14:58:08
问题 I'm using pyqt4 with python 2.7 and I have a list view widget that I can't add items to it # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'add_category.ui' # # Created: Mon Mar 19 23:22:30 2018 # by: PyQt4 UI code generator 4.10 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def