Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- import sys
- filename = ''
- export = True
- class MainApp(object):
- def __init__(self, master):
- self.gridFrame = Frame(master)
- for i in range(10):
- for j in range(10):
- Button(
- self.gridFrame,
- text=str(i)+','+str(j),
- ).grid(row=i,column=j)
- self.gridFrame.pack()
- def initiate():
- global filename
- global export
- try:
- filename = sys.argv[1]
- except IndexError:
- print('You need to provide a name for the file.')
- sys.exit()
- try:
- if sys.argv[2] == '-n':
- export = False
- else:
- export = True
- except IndexError:
- export = True
- def writeFinalToFile():
- global export
- if export:
- global filename
- file = open(filename + '.py','w')
- file.write('from characters import *\n')
- file.write('from mapClass import *\n\n')
- file.write(filename + ' = Map([\n')
- file.write('[]\n')
- file.write('])\n')
- file.close()
- initiate()
- root = Tk()
- mainApp = MainApp(root)
- root.mainloop()
- writeFinalToFile()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement