07 2011 档案
**pyqt_example_learn<wizard>
摘要:#-*- coding:gb2312 -*-import sysfrom PyQt4 import QtGui,QtCoredef create_page(): page = QtGui.QWizardPage() page.setTitle('introduction') page.setSubTitle('hello') label = QtGui.QLabel('xxxxxxx') label.setWordWrap(True) layout = QtGui.QVBoxLayout() layout.addWidget(label) pag
阅读全文
*cute_py<os.walk,os.listdir,os.stat>
摘要:import sys,osdef get(path): allfile = {} for root,dirs,files in os.walk(path): for onefile in files: fname = os.path.join(root,onefile) fsize = os.stat(fname).st_size if allfile.has_key(fsize): allfile[fsize].append(fname) else: allfile[fsize] = [fname] fsize_key = allfile.keys() fsize_key.sort() re
阅读全文
**pyqt_example_learn<syntaxhighlighter>
摘要:1 from PyQt4 import QtCore, QtGui 2 3 4 class MainWindow(QtGui.QMainWindow): 5 def __init__(self, parent=None): 6 super(MainWindow, self).__init__(parent) 7 8 self.setupFileMenu() 9 self.setupHelpMenu() 10 self.setupEditor() 11 12 self.setCentralWidget(self.editor) 13 self.setWindowTitle("Synta
阅读全文
**pyqt_example_learn<calendar>
摘要:from PyQt4 import QtCore, QtGuiclass MainWindow(QtGui.QMainWindow): def __init__(self): super(MainWindow,self).__init__() self.selectedDate = QtCore.QDate.currentDate() self.fontSize = 10 centralWidget = QtGui.QWidget() dateLabel = QtGui.QLabel('date') monthCombo = QtGui.QComboBox() for mont
阅读全文
**pyqt_example_learn<dir view>
摘要:from PyQt4 import QtGuiif __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) model = QtGui.QDirModel() tree = QtGui.QTreeView() tree.setModel(model) tree.setAnimated(False) # 展开方式 tree.setIndentation(20) # 压痕 tree.setSortingEnabled(True) # 排序 tree.setWindowTitle("Dir
阅读全文
**pyqt_example_learn<scribble>
摘要: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
阅读全文
**pyqt_example_learn<style>
摘要: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')
阅读全文
**pyqt_example_learn<wiggly>
摘要:// 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
阅读全文
**pyqt_example_learn<shapedclock>
摘要:# 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
阅读全文
**pyqt_example_learn<calculate>
摘要:// 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.
阅读全文
*py_描述符
摘要:##实现了__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
阅读全文
**pyqt_example_learn<clock>
摘要: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.
阅读全文
*pyqt_one<lcdnumber spinbox slider>
摘要: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)
阅读全文
*苏轼_<江城子*密州出猎>
摘要:苏轼_<江城子*密州出猎> 老夫聊发少年狂,左牵黄,右擎苍。 锦帽貂裘,千骑卷平冈。 为报倾城随太守,亲射虎,看孙郎。 酒酣胸胆尚开张,鬓微霜,又何妨! 持节云中,何日遣冯唐? 会挽雕弓如满月,西北望,射天狼。------勉
阅读全文
浙公网安备 33010602011771号