pyside使用qt的ui文件

C:\Python27\Scripts\pyside-uic.exe -o C:\form.py C:\form.ui

 

调用示例

 

#!usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from PySide.QtCore import *
from PySide.QtGui import *

from form import Ui_Widget

class MainUi(QDialog,Ui_Widget):
	def __init__(self,parent = None):
		super(MainUi,self).__init__(parent) #调用父类的初始化
		self.setupUi(self)
		self._connect_slot()
		
	def _connect_slot(self):#连接逻辑和界面
		self.textEdit.textChanged.connect(self.change_word)#同步textEdit和textBrowser的内容
		self.pushButton.clicked.connect(self.close)#退出按钮
		
	def change_word(self):#更改textBrowse显示内容
		text = "<font color = blue size = 40>"+self.textEdit.toPlainText()+"</font>"
		self.textBrowser.setText(text)
		 
def main():
	app = QApplication(sys.argv)
	ui = MainUi()
	ui.show()
	sys.exit(app.exec_())

if __name__ == '__main__':
	main()
posted @ 2012-01-19 11:10  catmelo  阅读(943)  评论(0编辑  收藏  举报