[PyQt] Main UI stuck when ping sub thread running
David Boddie
davidb at met.no
Wed Jun 25 13:40:33 BST 2014
On Tue Jun 24 17:51:05 BST 2014, 不坏阿峰 onlydebian wrote:
> any person can help?
Just looking quickly at your code, you seem to be calling doping() from the
main GUI thread, creating a new thread, then waiting for it to finish.
This will block the main GUI thread.
It is usually easier to use QThread instead of threading.Thread in PyQt code.
You can emit signals from the worker thread which you can receive in your
user interface code.
You would split up your doping() method into two: the first part would create
the new thread, connect a signal to a new getresponse() method in the myWidget
class and start the thread. The second part would be the new getresponse()
method, which would contain the code to update the text in the user interface.
David
2014-06-23 20:05 GMT+07:00 不坏阿峰 <onlydebian at gmail.com>:
> i want to make a tools to diagnosis network. but my Main UI will stuck
> when ping is running before finish. All i want is that when the sub thread
> is running, Main UI can use and go to other tab and can do other function.
>
> pls help me . many thanks
>
> ###########
> from mychart_ui import Ui_Form
> import verbose_ping01
> import threading
>
> class MyThread(threading.Thread):
> def __init__(self, func, args, name=''):
> threading.Thread.__init__(self)
> self.name = name
> self.func = func
> self.args = args
>
> def run(self):
> self.res = apply(self.func, self.args)
>
> def getRes(self):
> return self.res
> def myping(host):
> result = verbose_ping01.verbose_ping(host, count=500)
> return result
>
> class myWidget(QtGui.QWidget, Ui_Form):
> def __init__(self,parent=None):
> QtGui.QWidget.__init__(self, parent)
> self.setupUi(self)
> self.pushButton.clicked.connect(self.draw)
> self.pushButton_ping.clicked.connect(self.doping)
>
> def draw(self):
> print '='
> sc = MyStaticMplCanvas(self.matwidget, width=2, height=3, dpi=100)
> sc.show()
> def doping(self):
> thisthread = MyThread(myping,("192.168.123.50",))
> thisthread.start()
> thisthread.join()
> time.sleep(0.5)
> self.pingresult = thisthread.getRes()
> newtext = "\n".join(self.pingresult)
> self.pTE_pingresult.setPlainText(newtext)
>
> qApp = QtGui.QApplication(sys.argv)
> aw = myWidget()
> aw.show()
> sys.exit(qApp.exec_())
>
> [image: 内嵌图片 2]
> ########mychart_ui.py############
>
> # -*- coding: utf-8 -*-
>
> # Form implementation generated from reading ui file 'mychart.ui'
> #
> # Created: Sat Jun 21 21:43:55 2014
> # by: PyQt4 UI code generator 4.10.4
> #
> # 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 _translate(context, text, disambig):
> return QtGui.QApplication.translate(context, text, disambig,
> _encoding)
> except AttributeError:
> def _translate(context, text, disambig):
> return QtGui.QApplication.translate(context, text, disambig)
>
> class Ui_Form(object):
> def setupUi(self, Form):
> Form.setObjectName(_fromUtf8("Form"))
> Form.resize(945, 570)
> self.tabWidget = QtGui.QTabWidget(Form)
> self.tabWidget.setGeometry(QtCore.QRect(10, 20, 891, 491))
> self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
> self.tabWidgetPage1 = QtGui.QWidget()
> self.tabWidgetPage1.setObjectName(_fromUtf8("tabWidgetPage1"))
> self.gridLayoutWidget = QtGui.QWidget(self.tabWidgetPage1)
> self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 20, 851, 411))
> self.gridLayoutWidget.setObjectName(_fromUtf8("gridLayoutWidget"))
> self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
> self.gridLayout.setMargin(0)
> self.gridLayout.setHorizontalSpacing(0)
> self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
> self.piclabel_2 = QtGui.QLabel(self.gridLayoutWidget)
> sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
> QtGui.QSizePolicy.Fixed)
> sizePolicy.setHorizontalStretch(0)
> sizePolicy.setVerticalStretch(0)
>
> sizePolicy.setHeightForWidth(self.piclabel_2.sizePolicy().hasHeightForWidth())
> self.piclabel_2.setSizePolicy(sizePolicy)
> self.piclabel_2.setMinimumSize(QtCore.QSize(400, 400))
> palette = QtGui.QPalette()
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
> brush = QtGui.QBrush(QtGui.QColor(170, 156, 167, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 165))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active,
> QtGui.QPalette.AlternateBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active,
> QtGui.QPalette.ToolTipBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active,
> QtGui.QPalette.ToolTipText, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.WindowText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(170, 156, 167, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.BrightText, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.ButtonText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 165))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.AlternateBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.ToolTipBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.ToolTipText, brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.WindowText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(170, 156, 167, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.BrightText, brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.ButtonText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.AlternateBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.ToolTipBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.ToolTipText, brush)
> self.piclabel_2.setPalette(palette)
> self.piclabel_2.setAutoFillBackground(True)
> self.piclabel_2.setTextFormat(QtCore.Qt.PlainText)
> self.piclabel_2.setObjectName(_fromUtf8("piclabel_2"))
> self.gridLayout.addWidget(self.piclabel_2, 0, 2, 1, 1)
> self.piclabel = QtGui.QLabel(self.gridLayoutWidget)
> self.piclabel.setMinimumSize(QtCore.QSize(421, 400))
> palette = QtGui.QPalette()
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
> brush = QtGui.QBrush(QtGui.QColor(170, 156, 167, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 165))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active,
> QtGui.QPalette.AlternateBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active,
> QtGui.QPalette.ToolTipBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Active,
> QtGui.QPalette.ToolTipText, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.WindowText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(170, 156, 167, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.BrightText, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.ButtonText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 165))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.AlternateBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.ToolTipBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Inactive,
> QtGui.QPalette.ToolTipText, brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.WindowText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 244, 253, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(170, 156, 167, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.BrightText, brush)
> brush = QtGui.QBrush(QtGui.QColor(127, 117, 125, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.ButtonText, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow,
> brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 234, 251, 75))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.AlternateBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.ToolTipBase, brush)
> brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
> brush.setStyle(QtCore.Qt.SolidPattern)
> palette.setBrush(QtGui.QPalette.Disabled,
> QtGui.QPalette.ToolTipText, brush)
> self.piclabel.setPalette(palette)
> self.piclabel.setAutoFillBackground(True)
> self.piclabel.setTextFormat(QtCore.Qt.PlainText)
> self.piclabel.setObjectName(_fromUtf8("piclabel"))
> self.gridLayout.addWidget(self.piclabel, 0, 1, 1, 1)
> self.tabWidget.addTab(self.tabWidgetPage1, _fromUtf8(""))
> self.tab = QtGui.QWidget()
> self.tab.setObjectName(_fromUtf8("tab"))
> self.matwidget = QtGui.QWidget(self.tab)
> self.matwidget.setGeometry(QtCore.QRect(80, 30, 611, 431))
> self.matwidget.setObjectName(_fromUtf8("matwidget"))
> self.tabWidget.addTab(self.tab, _fromUtf8(""))
> self.tab_2 = QtGui.QWidget()
> self.tab_2.setObjectName(_fromUtf8("tab_2"))
> self.lineEdit_ip = QtGui.QLineEdit(self.tab_2)
> self.lineEdit_ip.setGeometry(QtCore.QRect(80, 60, 113, 20))
> self.lineEdit_ip.setObjectName(_fromUtf8("lineEdit_ip"))
> self.pushButton_ping = QtGui.QPushButton(self.tab_2)
> self.pushButton_ping.setGeometry(QtCore.QRect(220, 60, 75, 23))
> self.pushButton_ping.setObjectName(_fromUtf8("pushButton_ping"))
> self.pTE_pingresult = QtGui.QPlainTextEdit(self.tab_2)
> self.pTE_pingresult.setGeometry(QtCore.QRect(80, 140, 561, 231))
> self.pTE_pingresult.setObjectName(_fromUtf8("pTE_pingresult"))
> self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
> self.pushButton = QtGui.QPushButton(Form)
> self.pushButton.setGeometry(QtCore.QRect(160, 10, 75, 23))
> self.pushButton.setObjectName(_fromUtf8("pushButton"))
>
> self.retranslateUi(Form)
> self.tabWidget.setCurrentIndex(2)
> QtCore.QMetaObject.connectSlotsByName(Form)
>
> def retranslateUi(self, Form):
> Form.setWindowTitle(_translate("Form", "Form", None))
> self.piclabel_2.setText(_translate("Form", "Percent", None))
> self.piclabel.setText(_translate("Form", "Percent", None))
>
> self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1),
> _translate("Form", "百分图", None))
> self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab),
> _translate("Form", "页", None))
> self.pushButton_ping.setText(_translate("Form", "ping", None))
> self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2),
> _translate("Form", "页", None))
> self.pushButton.setText(_translate("Form", "PushButton", None))
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140624/56ea80b6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 9135 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140624/56ea80b6/attachment-0001.png>
Previous message: [PyQt] Main UI stuck when ping sub thread running
Next message: [PyQt] Drag and Drop of subclassed QListWidgetItem
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the PyQt mailing list
More information about the PyQt
mailing list