码迷,mamicode.com
首页 > 编程语言 > 详细

Python-文件修改器

时间:2015-07-15 18:54:37      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

#-*- coding: utf-8 -*-

import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class Change(QWidget):
    def __init__(self, parent = None):
        super(Change, self).__init__(parent)

        self.setWindowTitle(u"文件更改器")
        self.setWindowFlags(Qt.WindowMinimizeButtonHint)
        self.setFixedSize(200, 200)

        btnFile = QPushButton(u"修改文件")
        btnDir = QPushButton(u"修改文件夹")

        QObject.connect(btnFile, SIGNAL("clicked()"), self.changeFile)
        QObject.connect(btnDir, SIGNAL("clicked()"), self.changeDir)

        hbox = QHBoxLayout()
        hbox.addWidget(btnFile)
        hbox.addWidget(btnDir)

        self.setLayout(hbox)

        self.center()
    def center(self):
        screenGeometry = QDesktopWidget()
        windowGeometry = self.size()

        self.move((screenGeometry.width() - windowGeometry.width()) / 2, (screenGeometry.height() - windowGeometry.height()) / 2)

    def changeDir(self):
        dirName = QFileDialog.getExistingDirectory(self, u"请选择要修改的文件夹")
        if not dirName.isEmpty():
            pass

    def changeFile(self):
        pass

app = QApplication(sys.argv)
change = Change()
change.show()
sys.exit(app.exec_())

 

Python-文件修改器

标签:

原文地址:http://www.cnblogs.com/JohnABC/p/4649045.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!