파일 여러개 골라두면 한번에 열어주는 파일을 자동생성하는 프로그램

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

import wx

import os

import sys

import os.path

reload(sys)

sys.setdefaultencoding(‘cp949’)

def myfileopen(f):

myf=open(“my.bat”,”a”)

myf.write(” “+str(f))

myf.close()

class mainframe(wx.Frame):

def __init__(self, *args, **kwds):

kwds[“style”] = wx.DEFAULT_FRAME_STYLE

wx.Frame.__init__(self, *args, **kwds)

dig = wx.FileDialog(None, message=”Choose data files”, style = wx.FD_MULTIPLE)

if dig.ShowModal() == wx.ID_OK:

if os.path.isfile(“my.bat”):

myf=open(“my.bat”,”a”)

else:

myf=open(“my.bat”,”w”)

myf.write(“C:\\Notepad\\notepad.exe”)

myf.close()

for fn in dig.GetPaths():

myfileopen(fn)

class conv(wx.App):

def OnInit(self):

wx.InitAllImageHandlers()

main = mainframe(None, -1, “”)

self.SetTopWindow(main)

main.Show(True)

main.Show(False)

exit()

return 1

if __name__ == “__main__”:

conv = conv(0)

conv.MainLoop()

…이딴걸 어따 써먹지…


게시됨

카테고리

작성자

태그:

댓글

댓글 남기기

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

%d 블로거가 이것을 좋아합니다: