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

# -*- 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()

…이딴걸 어따 써먹지…

댓글 남기기

이메일은 공개되지 않습니다.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

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