auto-scripts/auto-wxPython.py
#!/usr/bin/env python3
import sys
import os
t='''#!/usr/bin/env python3
import wx
class TFrame(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, title=title, size=(350,200))
app = wx.App(redirect=True)
top = TFrame("Hello World")
top.Show()
app.MainLoop()
'''
try:
path=os.path.join(os.getcwd(), sys.argv[1])
except IndexError:
print("Si usa cosi' : auto-wxPython.py <nome progetto>")
exit(-1)
try:
os.mkdir(path)
except FileExistsError:
print("Esiste una cartella con lo stesso nome! Esco.")
exit(-1)
os.chdir(path)
f = open("main.py", "a")
f.write(t)
f.close()