摘要:
import sipsip.setapi('QString', 2)sip.setapi('QVariant', 2)from PyQt4 import QtCore, QtGuiclass ScribbleArea(QtGui.QWidget): def __init__(self, parent=None): super(ScribbleArea, self).__init__(parent) self.setAttribute(QtCore.Qt.WA_StaticContents) self.modified = False self.scribblin 阅读全文
摘要:
from PyQt4 import QtCore, QtGuiclass WidgetGallery(QtGui.QDialog): def __init__(self,parent=None): super(WidgetGallery,self).__init__(parent) self.palette = QtGui.QApplication.palette() combo_box = QtGui.QComboBox() combo_box.addItems(QtGui.QStyleFactory.keys()) label = QtGui.QLabel('style') 阅读全文
摘要:
// from pyqt_examplesfrom PyQt4 import QtCore, QtGuiclass WigglyWidget(QtGui.QWidget): def __init__(self, parent=None): super(WigglyWidget, self).__init__(parent) self.setBackgroundRole(QtGui.QPalette.Midlight) self.setAutoFillBackground(True) newFont = self.font() newFont.setPointSize(newFont.point 阅读全文
摘要:
# from pyqt_exampleimport sysfrom PyQt4 import QtGui,QtCoreclass ShapedClock(QtGui.QWidget): hourHand = QtGui.QPolygon([ QtCore.QPoint(7, 8), QtCore.QPoint(-7, 8), QtCore.QPoint(0, -40) ]) minuteHand = QtGui.QPolygon([ QtCore.QPoint(7, 8), QtCore.QPoint(-7, 8), QtCore.QPoint(0, -70) ]) hourColor = Q 阅读全文
摘要:
// calculate 1 # coding = gbk 2 import sys 3 from PyQt4 import QtCore,QtGui 4 5 class Button(QtGui.QToolButton): 6 def __init__(self,text,parent=None): 7 super(Button,self).__init__(parent) 8 self.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Preferred) 9 self.setText(text) 10 11 clas. 阅读全文
摘要:
##实现了__get__ and __set__ 的描述符称为数据描述符##只实现__get__的描述符称为非数据描述符## 描述符类 <定义另一个类特性可能访问方式的类>class upper_string(object): def __init__(self): self._value = '' def __get__(self,instance,klass): return self._value def __set__(self,instance,value): self._value = value.upper()class mine(object): a 阅读全文
摘要:
1 import sys 2 from PyQt4 import QtGui,QtCore 3 4 class Time(QtGui.QLCDNumber): 5 def __init__(self,parent=None): 6 QtGui.QLCDNumber.__init__(self,parent) 7 #self.setFixedSize(200,200) 8 self.setSegmentStyle(QtGui.QLCDNumber.Filled) 9 timer = QtCore.QTimer(self)10 timer.timeout.connect(self.show_ti. 阅读全文
摘要:
class Dialog(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) self.setFixedSize(200,200) self.spinbox = QtGui.QSpinBox() self.spinbox.setRange(0,100) self.spinbox.setValue(50) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.slider.setRange(0,100) self.lcd = QtGui.QLCDNumber(5) 阅读全文
摘要:
苏轼_<江城子*密州出猎> 老夫聊发少年狂,左牵黄,右擎苍。 锦帽貂裘,千骑卷平冈。 为报倾城随太守,亲射虎,看孙郎。 酒酣胸胆尚开张,鬓微霜,又何妨! 持节云中,何日遣冯唐? 会挽雕弓如满月,西北望,射天狼。------勉 阅读全文
摘要:
#enconding = utf-8a = [1,2,3]b = ['a','b','c']## 并行遍历zip(a,b)for (x,y) in zip(a,b): z[x] = ydict(zip(a,b)) ## zip 构造字典map(None,a,b)## 重新运算出参数的内容,把字符串转化成对象 [pickle module]eval('a') # [1, 2, 3]## append 在原处修改 , 返回 None ---> sort()a.append('a')a # [1, 2, 3, 阅读全文