#-*-coding:utf-8-*-ImportSYS fromPyqt4.qtguiImport* fromPyqt4.qtcoreImport*classChange (qwidget):def __init__(Self, parent =None): Super (change, self).__init__(parent) self.setwindowtitle (U"File Change Device") self.setwindowflags (qt.windowminimizebuttonhint) self.setfixedsize (200, 200) Btnfile= Qpushbutton (U"Modify a file") Btndir= Qpushbutton (U"Modify Folder") 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.ce Nter ()defCenter (self): Screengeometry=qdesktopwidget () windowgeometry=self.size () Self.move (Screengeometry.width ()-Windowgeometry.width ())/2, (Screengeometry.height ()-windowgeometry.height ())/2) defChangedir (self): DirName= Qfiledialog.getexistingdirectory (Self, U"Please select the folder you want to modify") if notdirname.isempty ():Pass defChangefile (self):Passapp=qapplication (SYS.ARGV) change=Change () change.show () Sys.exit (App.exec_ ())
python-file modifier