python Eric 的使用
最近使用python过程中,python界面的编程工具GTK-Python,但是界面的美观性不如Qt-Creator中的Qt-Designer,无法实现设计是视图绘制,有点让人失望。
网上发现有人介绍python Eric IDE,比较好奇,安装上看看吧:
#yum install eric4
但是新建的工程无法run,说缺少pyuic4,于是安装上开发包
#yum install PyQt4-devel
因为之前我按装了qt4.7类库,所以一切都那么顺其自然,新建了一个对话框,因为python eric 中嵌入了Qt -Designer工具,所以绘制的窗口比较美观,上档次,呵呵,不错,保存untitled.ui文件,关闭designer窗口,回到eric IDE 窗口发现在source视图下多了一个Ui_untitled.py文件:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/fedora11/myPro/eric/untitled.ui'
#
# Created: Mon Mar 8 11:00:42 2010
# by: PyQt4 UI code generator 4.7
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(334, 170)
self.heyButton = QtGui.QPushButton(Dialog)
self.heyButton.setGeometry(QtCore.QRect(60, 100, 85, 27))
self.heyButton.setObjectName("heyButton")
self.pushButton_2 = QtGui.QPushButton(Dialog)
self.pushButton_2.setGeometry(QtCore.QRect(200, 100, 85, 27))
self.pushButton_2.setObjectName("pushButton_2")
self.lineEdit = QtGui.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(90, 30, 151, 24))
self.lineEdit.setObjectName("lineEdit")
self.dial = QtGui.QDial(Dialog)
self.dial.setGeometry(QtCore.QRect(150, 60, 50, 64))
self.dial.setObjectName("dial")
self.retranslateUi(Dialog)
QtCore.QObje
相关文档:
对 Python 函数的"调制",是指对其做出合乎需求的设置。具体的调制方法,是将其参数设为固定值(常数)。
设定单一的参数值
原先的函数是这样的:
>>> def foo(cooked, standard):
... print "foo called with cooked: %s, standard: %s" % \
... (cooked, standard)
调用它:
>>> foo('a', ......
我知道的一种在
python
中
Singleton mode
的实现如下:
class Foo: pass
def
instance():
global inst
try:
inst
except:
inst =
Foo
()
&n ......
Python中Range和XRange的区别(Difference between Range and XRange in Python)
最近机器出了点问题,所以一直没有写新的东西出来。之前在读Python的代码的时候,发觉好多人喜欢用XRange,而不是Range,我也只是记得学习的时候开始学到的是Range,后面又看到有个XRange,当时也没有深究,为什么Python里面要有两个同样的功 ......
软件准备:
1.eclipse开发包,下载地址:http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR2/eclipse-java-galileo-SR2-win32.zip
2.pydev插件,下载地址:http://sourceforge.net/projects/pydev/files/pydev/Pydev%201.5.4/org.python.pydev.feature-1.5.4.2010011921 ......
最近在从头开始学习Python, 希望用blog顺便记录下来一些小的技巧。
今天记录第一个: variable _
在python的交互session中,也就是不带文件名直接输入"Python”之后python所创建的session,
变量"_"会保存上一次计算的结果。例如:
这个变量对经常把python当计算器用的同学可能有用。
参考:sys.displayhook( ......