Skip to content

Instantly share code, notes, and snippets.

@iOS0x00
Created January 1, 2014 13:03
Show Gist options
  • Save iOS0x00/8207901 to your computer and use it in GitHub Desktop.
Save iOS0x00/8207901 to your computer and use it in GitHub Desktop.
demo
#coding: utf-8
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
QTextCodec.setCodecForTr(QTextCodec.codecForName("utf8"))
class StandardDialog(QDialog):
def __init__(self,parent=None):
super(StandardDialog,self).__init__(parent)
self.setWindowTitle(u"ATVOD点播器")
filePushButton=QPushButton(self.tr(u"文件对话框"))
playButton = QPushButton(self.tr(u"播放"))
self.fileLineEdit=QLineEdit()
layout=QGridLayout()
layout.addWidget(filePushButton,0,0)
layout.addWidget(self.fileLineEdit,0,1)
layout.addWidget(playButton, 0, 2)
self.setLayout(layout)
self.connect(filePushButton,SIGNAL("clicked()"),self.openFile)
def openFile(self):
s=QFileDialog.getOpenFileName(self,u"选择本地影音文件","/","video files(*.mp4)")
print unicode(s,"utf-8")
self.fileLineEdit.setText(s)
app=QApplication(sys.argv)
form=StandardDialog()
form.show()
app.exec_()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment