def __init__(self, master, pack_params=None, grid_params=None): ttk.Frame.__init__(self, master) self.options = GlobalEnvironment.get_stylesheet() if grid_params: self.grid(grid_params) elif pack_params: self.pack(pack_params) else: self.pack(side='top') self.butt_frame = ttk.Frame(self) self.butt_frame.pack(side='top') self.prev_butt = ttk.Button(self.butt_frame, text='prev', command=self.prev_ship_info) self.prev_butt.pack(side='left') self.next_butt = ttk.Button(self.butt_frame, text='next', command=self.next_ship_info) self.next_butt.pack(side='right') self.ship_id = 1 self.ship_info = ShipInfo(self, ship_id=self.ship_id, pack_params={'side': 'bottom'})
def __init__(self, master, ship_id=0, pack_params=None, grid_params=None): ttk.Frame.__init__(self, master, style='UpgradeBar.TFrame', padding=2) self.options = GlobalEnvironment.get_stylesheet() if grid_params: self.grid(grid_params) elif pack_params: self.pack(pack_params) else: self.pack(side='top') self.current_ship_id = None self.upgrade_icons = UpgradeIcons() self.header = ttk.Label(self, style='Header.UpgradeBar.TLabel', text='Upgrade Bar', **self.options['header.upgrade_bar']) self.header.grid(row=0, column=0, columnspan=7, sticky='nsew') self.upgrade_slots = [] for j in range(7): self.upgrade_slots.append( ttk.Label(self, style='Slot.UpgradeBar.TLabel', text='', image=self.upgrade_icons.get_icon('blank_icon'), **self.options['slot.upgrade_bar'])) self.upgrade_slots[j].grid(row=1, column=j, sticky='nsew') self.update_upgrade_bar(ship_id)
def __init__(self, master, ship_id=0, pack_params=None, grid_params=None): ttk.Frame.__init__(self, master) self.options = GlobalEnvironment.get_stylesheet() self.maneuver_icons = ManeuverIcons() if grid_params: self.grid(grid_params) elif pack_params: self.pack(pack_params) else: self.pack(side='top') self.config_table = None self.maneuver_table = [] for i in range(6): self.maneuver_table.append([]) for j in range(9): self.maneuver_table[i].append( ttk.Label(self, style='Blank.ManeuverDial.TLabel', text='.', image=self.maneuver_icons.get_icon('blank_icon'), **self.options['label.maneuver_dial'])) self.maneuver_table[i][j].grid(row=i, column=j, sticky='nsew') self.__generate_speed_labels() self.update_dial(ship_id)
def __init__(self, master, ship_id=0, pack_params=None, grid_params=None): ttk.Frame.__init__(self, master, style='ShipStats.TFrame') self.options = GlobalEnvironment.get_stylesheet() if grid_params: self.grid(grid_params) elif pack_params: self.pack(pack_params) else: self.pack(side='top') self.current_ship_id = None self.headers = self.__generate_headers() self.ship_stats = [] for i in range(4): self.ship_stats.append(ttk.Label(self, style='ShipStats.TLabel')) self.ship_stats[i].grid(row=(i + 1), column=1, sticky='nsew') self.ship_stats[0].config(**self.options['attack.ship_stats']) self.ship_stats[1].config(**self.options['agility.ship_stats']) self.ship_stats[2].config(**self.options['hull.ship_stats']) self.ship_stats[3].config(**self.options['shield.ship_stats']) self.update_ship_stats(ship_id)
def __init__(self, master, ship_id=0, pack_params=None, grid_params=None): ttk.Frame.__init__(self, master) self.options = GlobalEnvironment.get_stylesheet() if grid_params: self.grid(grid_params) elif pack_params: self.pack(pack_params) else: self.pack(side='top') self.current_ship_id = None self.pilot_table = [] for i in range(15): self.pilot_table.append([]) for j in range(4): if i == 0: if j == 1: self.pilot_table[i].append( ttk.Label( self, style= 'PilotName.Header.Regular.PilotList.TLabel')) else: self.pilot_table[i].append( ttk.Label(self, style='Header.Regular.PilotList.TLabel')) elif i > 0 and j == 1: self.pilot_table[i].append([]) if i % 2 == 1: self.pilot_table[i][j].append( ttk.Frame( self, style='Odd.PilotList.TFrame', **self.options['p_name_frame.pilot_list'])) self.pilot_table[i][j].append( ttk.Label(self.pilot_table[i][j][0], style='Unique.PilotList.TLabel', **self.options['odd.pilot_list'])) self.pilot_table[i][j].append( ttk.Label(self.pilot_table[i][j][0], style='PilotName.PilotList.TLabel', **self.options['odd.pilot_list'])) else: self.pilot_table[i][j].append( ttk.Frame( self, style='Even.PilotList.TFrame', **self.options['p_name_frame.pilot_list'])) self.pilot_table[i][j].append( ttk.Label(self.pilot_table[i][j][0], style='Unique.PilotList.TLabel', **self.options['even.pilot_list'])) self.pilot_table[i][j].append( ttk.Label(self.pilot_table[i][j][0], style='PilotName.PilotList.TLabel', **self.options['even.pilot_list'])) self.pilot_table[i][j][1].grid(row=0, column=0, sticky='ns') self.pilot_table[i][j][2].grid(row=0, column=1, sticky='nsew') else: if i % 2 == 1: self.pilot_table[i].append( ttk.Label(self, style='Regular.PilotList.TLabel', **self.options['odd.pilot_list'])) else: self.pilot_table[i].append( ttk.Label(self, style='Regular.PilotList.TLabel', **self.options['even.pilot_list'])) if i > 0 and j == 1: self.pilot_table[i][j][0].grid(row=i, column=j, sticky='nsew') else: self.pilot_table[i][j].grid(row=i, column=j, sticky='nsew') self.__generate_header() self.update_pilot_list(ship_id=ship_id)
def run(self): self.root = tk.Tk() self.app = AppWindow(self.root) GlobalEnvironment.change_screen( MainMenu(GlobalEnvironment.get_master_frame())) self.root.mainloop()
def __init__(self, master=None): ttk.Frame.__init__(self, master) GlobalEnvironment.set_master_frame(master) self.pack() self.pack_propagate(1)
def __init__(self, master, ship_name='', ship_id=0, pack_params=None, grid_params=None): ttk.Frame.__init__(self, master) self.options = GlobalEnvironment.get_stylesheet() if grid_params: self.grid(grid_params) elif pack_params: self.pack(pack_params) else: self.pack(side='top') self.ship_name = ship_name self.ship_id = ship_id self.headers = [] self.fields = [] self.basic_info_frame = ttk.Frame(self) self.basic_info_frame.pack(side='top') self.__generate_headers_and_fields() self.bottom_frame = ttk.Frame(self) self.bottom_frame.pack(side='bottom') # generate blank ship_stats self.ship_stats = ShipStats(self.bottom_frame, self.ship_id, grid_params={ 'row': 0, 'column': 0, 'sticky': 'n' }) # generate blank action_bar self.action_bar = ActionBar(self.bottom_frame, self.ship_id, grid_params={ 'row': 1, 'column': 0 }) # generate blank upgrade_bar self.upgrade_bar = UpgradeBar(self.bottom_frame, self.ship_id, grid_params={ 'row': 2, 'column': 0 }) # generate empty maneuver_dial self.maneuver_dial = ManeuverDial(self.bottom_frame, self.ship_id, grid_params={ 'row': 0, 'column': 1 }) # generate empty pilot_list self.pilot_list = PilotList(self.bottom_frame, self.ship_id, grid_params={ 'row': 1, 'column': 1, 'sticky': 'n', 'rowspan': 2 }) self.update_ship_info(self.ship_id)