def __init__(self, mapper): """ create the interface """ self.mapper = mapper self.dialog = Window() self.dialog.setTitle('Mapper 1.0') # notebook tabs = ['Routine', 'Accumulate'] pages = self.dialog.addNotebook('notebook', tabs) # routine page self.routine = pages[0] today = datetime.date.today() self.dt = today.strftime('%d,%m,%Y,%B').split(',') self.routine.addEntry('title', 'Map Title', width=60) self.routine.set( 'title', '24 Hour Precipitation Ending 7 AM {0[3]} {0[0]}, {0[2]}'.format( self.dt)) self.routine.plot('title', row=0) self.routine.addEntry('outfile', 'Output Filename', width=40) self.routine.set('outfile', 'pcpn{0[1]}{0[0]}{0[2]}.png'.format(self.dt)) self.routine.plot('outfile', row=1) jobs = ['Make KMLs', 'Make Maps'] self.routine.addCheck('jobs', 'Jobs', jobs) self.routine.set('jobs', jobs[:2]) self.routine.plot('jobs', row=2) # accum pcpn page self.accum = pages[1] parms = [[2, 1, 12], [2, 1, 31], [4, 2000, 2100]] self.accum.addSpin('endDate', parms, '/', 'Ending Date', command=self.updateAccum) self.accum.set('endDate', [today.month, today.day, today.year]) self.accum.plot('endDate', row=0) self.accum.addSpin('daysBack', [[2, 1, 45]], '', 'Days back', command=self.updateAccum) self.accum.set('daysBack', [2]) self.accum.plot('daysBack', row=1) self.accum.addEntry('title', 'Title', width=60) self.accum.plot('title', row=2) self.accum.addEntry('outfile', 'Output Filename', width=40) self.accum.plot('outfile', row=3) self.updateAccum() # dialog self.dialog.addText('messages', 70, 15, 'Messages') self.dialog.plot('messages', row=1) self.dialog.addButton('commands', space=20) self.dialog.changeWidget('commands', 0, command=self.go) self.dialog.changeWidget('commands', 1, text='Exit') self.dialog.plot('commands', row=2) self.dialog.plot('notebook', row=0) self.dialog.set('notebook', 0)
def __init__(self): """ create the GUI """ categories = ['Trees', 'Birds', 'Flowers'] self.gui = Window() self.gui.setTitle('Dynamic Widget Demo') self.gui.addRadio('category', 'Item Types', categories) self.gui.addCombo('items', 'Items', None, postcommand=self.update) self.gui.addButton('command') self.gui.set('category', 'Trees') self.gui.set('items', '...') self.gui.plot('category', row=0) self.gui.plot('items', row=1, pady=20) self.gui.plot('command', row=2)
def __init__(self): # read configuration file self.config = configparser.ConfigParser() self.config.read('config_parameters.ini') # write gui self.gui = Window() self.gui.setTitle('Export ScanInfo to Gsheet') self.gui.addChooseDir('dir_date', 'Scan Date Folder', width=40, initialdir='') self.gui.addEntry('para_list', 'Parameters to list', width=50) self.gui.addCombo('gdir', 'Save location in google drive', None, postcommand=self.gdir_update, width=47) self.gui.set('para_list', self.config['DEFAULT']['parameters']) self.gui.addText('status', width=40, height=5, prompt='Status:') self.gui.addCheck('auto_update', '', ['Turn On Auto Update']) self.gui.addButton('commands') self.gui.changeWidget('commands', 0, text='Export', command=self.export) self.gui.plot('dir_date', row=0) self.gui.plot('para_list', row=1, pady=5) self.gui.plot('gdir', row=2, pady=5) self.gui.plot('status', row=3, pady=10) self.gui.plot('auto_update', row=4) self.gui.plot('commands', row=5, pady=10) self.exported = False self.proj = None # bella project name self.g_name = None # google drive folder name self.g_ID = None # google drive folder id self.autoupdateOn = False self.update()
def __init__(self): """ create the GUI """ counties = ['Clark','Crawford','Dubois','Floyd','Harrison','Jefferson', 'Orange','Perry','Scott','Washigton'] damage = ['EF0','EF1','EF2','EF3','EF4','EF5'] dateParms = [[2,1,12],[2,1,12],[4,1900,2100]] initDate = [1,1,1980] cols = [['Date', 100],['County', 100],['Damage', 100]] self.gui = Window() self.gui.setTitle('Tornado Path Generator') self.gui.addSpin('tdate', dateParms, '/', 'Date of Tornado') self.gui.set('tdate', initDate) self.gui.addCombo('county', 'Affected County', counties) self.gui.addRadio('level', 'Maximum EF Damage', damage) self.gui.addCollector('paths', 10, cols, ['tdate','county','level'], 'Included Tornadoes') self.gui.addButton('command') self.gui.plot('tdate', row=0, pady=5) self.gui.plot('county', row=1, pady=5) self.gui.plot('level', row=2, pady=5) self.gui.plot('paths', row=3, pady=5) self.gui.plot('command', row=4, pady=10)
from tkintertoy import Window gui = Window() gui.setTitle('Create a Map') csv = [('CSV files', ('*.csv'))] gui.addOpen('input', 'Input CSV filename', width=40, filetypes=csv) png = [('PNG files', ('*.png'))] gui.addSaveAs('output', 'Output PNG filename', width=40, filetypes=png) gui.addEntry('title', 'Map Title', width=40) gui.addText('status', width=40, height=5, prompt='Status:') gui.addButton('commands') gui.plot('input', row=0, pady=10) gui.plot('output', row=1, pady=10) gui.plot('title', row=2, pady=10) gui.plot('status', row=3, pady=10) gui.plot('commands', row=4, pady=20) gui.waitforUser() if gui.content: message = 'Converting {} into {}...\n'.format(gui.get('input'), gui.get('output')) gui.set('status', message) gui.master.after(5000) # magic map making code goes here... gui.cancel()
def __init__(self, stopwatch): """ init stopwatch gui stopwatch:Stopwatch -> """ self.win = Window() # make window an attribute self.stopw = stopwatch # make stopwatch an attribute self.makeGui() # create gui
def __init__(self): self.gui = Window() self.gui.setTitle('Tkintertoy Gallery') self.makeGui()