def __init__(self, *args, **kwargs): ttk.Frame.__init__(self, *args, **kwargs) title = ttk.Label(self, text='Wild Pokemon Editor', style='Title.TLabel') self.entry_id = EntryLabel(self, text='ID') self.entry_min = EntryLabel(self, text='Minimum Level') self.entry_max = EntryLabel(self, text='Maximum Level') self.entry_rarity = EntryLabel(self, text='Rarity (1-?)') sep = ttk.Separator(self, orient=tk.HORIZONTAL) override_lbl = ttk.Label(self, text='Overrides', style='Subtitle.TLabel') self.string = EntryLabel(self, text='String Code') self.code = EntryLabel(self, text='Value') self.choices = ListChoice(self) self.add = ttk.Button(self, text='Add') for entry in (self.entry_id, self.entry_min, self.entry_max, self.entry_rarity, self.code): intValidate(entry.entry, 'u16') title.pack(padx=10) self.entry_id.pack(fill=tk.X) self.entry_min.pack(fill=tk.X) self.entry_max.pack(fill=tk.X) self.entry_rarity.pack(fill=tk.X) sep.pack(fill=tk.X, pady=(12, 0), padx=5) override_lbl.pack() self.string.pack(fill=tk.X) self.code.pack(fill=tk.X) self.choices.pack(pady=(10, 5), expand=tk.YES, fill=tk.BOTH) self.add.pack(pady=(5, 0))
def __init__(self, parent=None, **kwargs): ttk.Frame.__init__(self, parent, **kwargs) self.colors = (0, 0, 0) self.signal_color_selected = Signal() color_frm = ttk.Frame(self) self.text = EntryLabel(self, text='Text') self.size = EntryLabel(self, text='Font Size') self.color_button = ttk.Button(color_frm, text='Color', command=self.choose_color) self.color_preview = tk.Canvas(color_frm, width=90, height=20, bg=self.rgb_to_hex(0, 0, 0), relief=tk.GROOVE, bd=5, highlightthickness=0) self.text.pack(fill=tk.X) self.size.pack(fill=tk.X) color_frm.pack(expand=tk.YES) self.color_button.pack(padx=10, pady=(5, 0), side=tk.LEFT) self.color_preview.pack(padx=10, pady=(5, 0), side=tk.LEFT) intValidate(self.size.entry, 'u16')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) title = ttk.Label(self, text='Item Database Editor', style='Title.TLabel') self.sort = SortBox(self) self.items = ListChoice(self) sep = ttk.Separator(self) self.add_button = ttk.Button(self, text='Add') grid = WidgetGrid(self, 2) self.id = grid.add_widget(EntryLabel, text='ID', expand=tk.YES) self.price = grid.add_widget(EntryLabel, text='Sell Price', expand=tk.YES) self.name = grid.add_widget(EntryLabel, text='Name', expand=tk.YES) description_label = ttk.Label(self, text='Description') self.description = VariableText(self, height=10, width=50) title.pack() self.sort.pack(expand=tk.YES, fill=tk.X, pady=5) self.items.pack(expand=tk.YES, fill=tk.BOTH) self.add_button.pack() sep.pack(fill=tk.X, pady=(10, 0), padx=10) grid.pack(fill=tk.X) description_label.pack() self.description.pack(fill=tk.BOTH) intValidate(self.id.entry, 'u16') intValidate(self.price.entry, 'u32')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) title = ttk.Label(self, text='Credits Editor', style='Title.TLabel') self.checkVar = tk.IntVar() chk = ttk.Checkbutton(self, text='Add Before?', variable=self.checkVar) self.list = ListChoice(self) butFrame = ttk.Frame(self) self.add_text_button = ttk.Button(butFrame, text='Add Text', width=14) self.add_image_button = ttk.Button(butFrame, text='Add Image', width=14) entry_frm = ttk.Frame(self) self.x_pos = EntryLabel(entry_frm, text='X Position') self.y_buf = EntryLabel(entry_frm, text='Y Buffer') self.multi_widget = MultiWidget(self) title.pack() chk.pack() self.list.pack(expand=tk.YES, fill=tk.BOTH) butFrame.pack(fill=tk.X, pady=(5, 5)) self.add_text_button.pack(side=tk.LEFT, padx=10, expand=tk.YES) self.add_image_button.pack(side=tk.LEFT, padx=10, expand=tk.YES) entry_frm.pack(fill=tk.X) self.x_pos.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X, padx=5) self.y_buf.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X, padx=5) self.multi_widget.pack(fill=tk.BOTH) intValidate(self.x_pos.entry, 'u16') intValidate(self.y_buf.entry, 'u16')
def make_base_stats_widget(self, parent=None): grid = WidgetGrid(parent, 2) widgets = [] for text in self.STATS: widget = grid.add_widget(EntryLabel, text=text, expand=tk.YES) intValidate(widget.entry, 'u16') widgets.append(widget) return widgets, grid
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) self.entries = [] title = ttk.Label(self, text='Travel Map Editor', style='Title.TLabel') self.maps = ListChoice(self) self.add_button = ttk.Button(self, text='Add') sep = ttk.Separator(self, orient=tk.HORIZONTAL) top = ttk.Frame(self) mid = ttk.Frame(self) bot = ttk.Frame(self) self.entry_x = EntryLabel(top, text='X Position') self.entry_y = EntryLabel(top, text='Y Position') self.entry_display = EntryLabel(mid, text='Display Name') self.entry_ref = EntryLabel(mid, text='Reference Name') self.entry_map = EntryLabel(bot, text='Map Name') self.entry_spawn = EntryLabel(bot, text='Spawn ID') self.entries += self.entry_x, self.entry_y, self.entry_display, self.entry_ref, self.entry_map, self.entry_spawn title.pack() self.maps.pack(expand=tk.YES, fill=tk.BOTH) self.add_button.pack(pady=10) sep.pack(fill=tk.X, padx=10) top.pack(fill=tk.BOTH) mid.pack(fill=tk.BOTH) bot.pack(fill=tk.BOTH) self.entry_x.pack(expand=tk.YES, fill=tk.X, side=tk.LEFT, padx=(0, 5)) self.entry_y.pack(expand=tk.YES, fill=tk.X, side=tk.LEFT, padx=(5, 0)) self.entry_display.pack(expand=tk.YES, fill=tk.X, side=tk.LEFT, padx=(0, 5)) self.entry_ref.pack(expand=tk.YES, fill=tk.X, side=tk.LEFT, padx=(5, 0)) self.entry_map.pack(expand=tk.YES, fill=tk.X, side=tk.LEFT, padx=(0, 5)) self.entry_spawn.pack(expand=tk.YES, fill=tk.X, side=tk.LEFT, padx=(5, 0), pady=(10, 2)) for entry in self.entry_x, self.entry_y, self.entry_spawn: intValidate(entry.entry, 'u16')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) self.nodes = [] self.check = ttk.Checkbutton(self, text='Reverse loop') self.node_list = ListChoice(self) lbl = ttk.Label(self, text='Direction') self.direction = ttk.Combobox(self, justify=tk.CENTER, value=(D_UP, D_LEFT, D_RIGHT, D_DOWN)) self.steps = EntryLabel(self, text='Number of Steps') self.add_button = ttk.Button(self, text='Add') self.check.pack() self.node_list.pack(expand=tk.YES, fill=tk.BOTH) lbl.pack() self.direction.pack(fill=tk.X) self.steps.pack(fill=tk.X) self.add_button.pack(pady=5) self.direction.state(['readonly']) intValidate(self.steps.entry, 'u8')
def __init__(self, parent=None, title='Stats'): ttk.Frame.__init__(self, parent) label = ttk.Label(self, text=title, style='Subtitle.TLabel') grid = WidgetGrid(self, 2) self.attack = grid.add_widget(EntryLabel, text='Attack') self.defense = grid.add_widget(EntryLabel, text='Defense') self.special_attack = grid.add_widget(EntryLabel, text='Sp. Attack') self.special_defense = grid.add_widget(EntryLabel, text='Sp. Defense') self.hp = grid.add_widget(EntryLabel, text='HP') self.speed = grid.add_widget(EntryLabel, text='Speed') self.accuracy = grid.add_widget(EntryLabel, text='Accuracy') self.evade = grid.add_widget(EntryLabel, text='Evade') self.critical = grid.add_widget(EntryLabel, text='Critical') self.all_widgets = (self.attack, self.defense, self.special_attack, self.special_defense, self.hp, self.speed, self.accuracy, self.evade, self.critical) label.pack() grid.pack(expand=tk.YES, fill=tk.X) for widget in self.all_widgets: intValidate(widget.entry, 'u16')
def __init__(self, parent=None): FailLine.__init__(self, parent) intValidate(self.label.entry, 'u16')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) self.radius = EntryLabel(self, text='Wander Radius') self.radius.pack(expand=tk.YES, fill=tk.X) intValidate(self.radius.entry, 'u8')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) lft_frm = ttk.Frame(self) title = ttk.Label(lft_frm, text='Move Database Editor', style='Title.TLabel') self.sort = SortBox(lft_frm) self.items = ListChoice(lft_frm, width=50, height=12) self.add_button = ttk.Button(lft_frm, text='Add') sep6 = ttk.Separator(lft_frm) desc_lbl = ttk.Label(lft_frm, text='Description', style='Subtitle.TLabel') self.description = VariableText(lft_frm, width=40, height=10) sep = ttk.Separator(self, orient=tk.VERTICAL) middle_frm = ttk.Frame(self) grid = WidgetGrid(middle_frm, 4) self.id = grid.add_widget(EntryLabel, text='ID', expand=tk.YES) self.name = grid.add_widget(EntryLabel, text='Name', expand=tk.YES) self.base_xp = grid.add_widget(EntryLabel, text='Base XP Yield', expand=tk.YES) self.xp_group = grid.add_widget(ComboLabel, text='XP Group', expand=tk.YES) self.special_id = grid.add_widget(EntryLabel, text='Special Ability ID', expand=tk.YES) self.type = grid.add_widget(EntryLabel, text='Type', expand=tk.YES) self.evolve_level = grid.add_widget(EntryLabel, text='Evolve Level', expand=tk.YES) self.evolve_id = grid.add_widget(EntryLabel, text='Evolve ID', expand=tk.YES) sep2 = ttk.Separator(middle_frm) base_frm = ttk.Frame(middle_frm) self.base_stats = StatsGUI(base_frm, title='Base Stats') sep3 = ttk.Separator(base_frm, orient=tk.VERTICAL) self.ev_stats = StatsGUI(base_frm, title='EV Awards') sep4 = ttk.Separator(middle_frm) learn_move_frm = ttk.Frame(middle_frm) move_lbl = ttk.Label(learn_move_frm, text='Learned Moves', style='Subtitle.TLabel') self.learn_list = ListChoice(learn_move_frm, width=40, height=8) self.add_learn_move = ttk.Button(learn_move_frm, text='Add') move_frm = ttk.Frame(learn_move_frm) self.learn_move_id = EntryLabel(move_frm, text='Move ID') self.learn_level = EntryLabel(move_frm, text='Learn Level') sep5 = ttk.Separator(middle_frm, orient=tk.VERTICAL) available_frm = ttk.Frame(middle_frm) available_lbl = ttk.Label(available_frm, text='Available Moves', style='Subtitle.TLabel') self.available_list = ListChoice(available_frm, width=40, height=8) self.add_available_button = ttk.Button(available_frm, text='Add') self.available_move_id = EntryLabel(available_frm, text='Move ID') lft_frm.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH) title.pack() self.sort.pack(fill=tk.X, pady=5) self.items.pack(expand=tk.YES, fill=tk.BOTH) self.add_button.pack() sep6.pack(fill=tk.X, padx=10, pady=10) desc_lbl.pack() self.description.pack(expand=tk.YES, fill=tk.BOTH) sep.pack(side=tk.LEFT, fill=tk.Y, padx=10, pady=10) middle_frm.pack(side=tk.LEFT, fill=tk.BOTH) grid.pack(fill=tk.X) sep2.pack(fill=tk.X, pady=(10, 0), padx=10) base_frm.pack(fill=tk.X) self.base_stats.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X) sep3.pack(side=tk.LEFT, fill=tk.Y, padx=10, pady=10) self.ev_stats.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X) sep4.pack(fill=tk.X, pady=10, padx=10) learn_move_frm.pack(side=tk.LEFT, fill=tk.BOTH) move_lbl.pack() self.learn_list.pack(expand=tk.YES, fill=tk.BOTH) self.add_learn_move.pack(pady=(3, 0)) move_frm.pack(fill=tk.X) self.learn_move_id.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X, padx=2) self.learn_level.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X, padx=2) sep5.pack(side=tk.LEFT, fill=tk.Y, padx=10, pady=10) available_frm.pack(side=tk.LEFT, fill=tk.BOTH) available_lbl.pack() self.available_list.pack(expand=tk.YES, fill=tk.BOTH) self.add_available_button.pack(pady=(3, 0)) self.available_move_id.pack(fill=tk.X) for widget in self.type, self.special_id, self.learn_level, self.evolve_level, self.evolve_id: intValidate(widget.entry, 'u8') for widget in self.id, self.base_xp, self.available_move_id, self.learn_move_id: intValidate(widget.entry, 'u16')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) lft_frm = ttk.Frame(self) title = ttk.Label(lft_frm, text='Move Database Editor', style='Title.TLabel') self.sort = SortBox(lft_frm) self.items = ListChoice(lft_frm, width=50) self.add_button = ttk.Button(lft_frm, text='Add') right_frm = ttk.Frame(self) sep2 = ttk.Separator(self, orient=tk.VERTICAL) self.name = EntryLabel(right_frm, text='Name') id_frm = ttk.Frame(right_frm) self.id = EntryLabel(id_frm, text='ID') self.classification = ComboLabel(id_frm, text='Move Classification', values=list(CLASSIFICATIONS.keys())) grid = WidgetGrid(right_frm, 3) self.attack = grid.add_widget(EntryLabel, text='Attack') self.accuracy = grid.add_widget(EntryLabel, text='Accuracy') self.effect = grid.add_widget(EntryLabel, text='Effect') self.priority = grid.add_widget(EntryLabel, text='Priority') self.pp = grid.add_widget(EntryLabel, text='PP') self.type = grid.add_widget(EntryLabel, text='Type') self.chance = grid.add_widget(EntryLabel, text='Chance of Effect') self.intensity = grid.add_widget(EntryLabel, text='Effect Intensity') self.score = grid.add_widget(EntryLabel, text='Effect Score') self.attacker_anim = grid.add_widget(EntryLabel, text='Attacker Anim', expand=tk.YES) self.defender_anim = grid.add_widget(EntryLabel, text='Defender Anim', expand=tk.YES) chk_frm = ttk.Frame(right_frm) self.is_special = ttk.Checkbutton(chk_frm, text='Is Special') self.targets_self = ttk.Checkbutton(chk_frm, text='Targets Self') description_label = ttk.Label(right_frm, text='Description') self.description = VariableText(right_frm, height=10, width=40) lft_frm.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH) title.pack() self.sort.pack(fill=tk.X, pady=5) self.items.pack(expand=tk.YES, fill=tk.BOTH) self.add_button.pack() right_frm.pack(fill=tk.BOTH, side=tk.RIGHT) sep2.pack(expand=tk.YES, fill=tk.Y, padx=10, pady=10) self.name.pack(fill=tk.X) id_frm.pack(fill=tk.X) self.id.pack(side=tk.LEFT, fill=tk.X, padx=2) self.classification.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X, padx=(2, 2)) grid.pack(fill=tk.BOTH) chk_frm.pack() self.is_special.pack(side=tk.LEFT, fill=tk.X) self.targets_self.pack(side=tk.LEFT, fill=tk.X) description_label.pack() self.description.pack(expand=tk.YES, fill=tk.BOTH) self.classification.state(('readonly', )) for widget in self.id, self.attack, self.accuracy, self.priority, self.pp: intValidate(widget.entry, 'u16') for widget in self.type, self.effect, self.intensity, self.score, self.chance: intValidate(widget.entry, 'u8')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) self.aiTypes = { AI_RANDOM: 0, AI_DUMB: 1, AI_SMART: 2, AI_SUICIDAL: 3, AI_AGGRESSIVE: 4, AI_DEFENSIVE: 5, AI_AVERAGE: 6, AI_ADAPTIVE: 7 } title = ttk.Label(self, text='Trainer Editor', style='Title.TLabel') left_frm = ttk.Frame(self) grid = WidgetGrid(left_frm, 2) self.name = grid.add_widget(EntryLabel, text='Trainer Name') self.anim_name = grid.add_widget(EntryLabel, text='Animation Name') self.before_convo = grid.add_widget(EntryLabel, text='Before Battle Convo') self.after_convo = grid.add_widget(EntryLabel, text='After Battle Convo') self.lost_text = grid.add_widget(EntryLabel, text='Lost Battle Text') self.sight_range = grid.add_widget(EntryLabel, text='Sight Range') self.playlist = grid.add_widget(EntryLabel, text='Playlist') self.background = grid.add_widget(EntryLabel, text='Background Image') grid.add_widget(ttk.Label, text='AI Type', width=12, anchor=tk.CENTER) grid.add_widget(ttk.Label, text='Motion Type', width=12, anchor=tk.CENTER) self.ai_type = grid.add_widget( ttk.Combobox, values=(AI_RANDOM, AI_DUMB, AI_SMART, AI_SUICIDAL, AI_AGGRESSIVE, AI_DEFENSIVE, AI_AVERAGE, AI_ADAPTIVE), justify=tk.CENTER) self.motion_type = grid.add_widget(ttk.Combobox, values=(B_STILL, B_SPIN, B_FOLLOW, B_WANDER), justify=tk.CENTER) sep = ttk.Separator(left_frm) second_row = ttk.Frame(left_frm) col1 = ttk.Frame(second_row) peoplemon_lbl = ttk.Label(col1, text='Peoplemon List') self.peoplemon_list = ListChoice(col1) self.file_name = EntryLabel(col1, text='Filename') self.add_peoplemon = ttk.Button(col1, text='Add') col2 = ttk.Frame(second_row) item_lbl = ttk.Label(col2, text='Item List') self.item_list = ListChoice(col2) self.item_id = EntryLabel(col2, text='Item ID') self.add_item = ttk.Button(col2, text='Add') self.right_frm = ttk.Frame(self) sep2 = ttk.Separator(self.right_frm, orient=tk.VERTICAL) motion_lbl = ttk.Label(self.right_frm, text='Motion Options', style='Subtitle.TLabel') self.behavior_widget = BehaviorWidget(self.right_frm) title.pack() left_frm.pack(expand=tk.YES, fill=tk.BOTH, side=tk.LEFT) grid.pack(expand=tk.YES, fill=tk.X) sep.pack(expand=tk.YES, fill=tk.X, padx=10, pady=5) second_row.pack(expand=tk.YES, fill=tk.BOTH, padx=20) col1.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH, padx=(0, 20)) col2.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH, padx=(20, 0)) peoplemon_lbl.pack() self.peoplemon_list.pack(expand=tk.YES, fill=tk.BOTH) self.file_name.pack(expand=tk.YES, fill=tk.X) self.add_peoplemon.pack(pady=(10, 0)) item_lbl.pack() self.item_list.pack(expand=tk.YES, fill=tk.BOTH) self.item_id.pack(expand=tk.YES, fill=tk.X) self.add_item.pack(pady=(10, 0)) self.right_frm.pack(fill=tk.BOTH, side=tk.LEFT) sep2.pack(fill=tk.Y, padx=(10, 0), side=tk.LEFT) motion_lbl.pack(padx=10) self.behavior_widget.pack(expand=tk.YES, fill=tk.BOTH) self.ai_type.state(['readonly']) self.motion_type.state(['readonly']) intValidate(self.sight_range.entry, 'u8') intValidate(self.item_id.entry, 'u16')
def __init__(self, parent=None): ttk.Frame.__init__(self, parent) second_row_frm = ttk.Frame(self) leftFrm = ttk.Frame(second_row_frm) sep1 = ttk.Separator(second_row_frm, orient=tk.VERTICAL) middleFrm = ttk.Frame(second_row_frm) sep2 = ttk.Separator(second_row_frm, orient=tk.VERTICAL) rightFrm = ttk.Frame(second_row_frm) moves_frm = ttk.Frame(leftFrm) title = ttk.Label(self, text='Trainer Peoplemon Editor', style='Title.TLabel') grid1 = WidgetGrid(leftFrm, 2) self.nick = grid1.add_widget(EntryLabel, text='Nickname') self.id = grid1.add_widget(EntryLabel, text='ID') self.level = grid1.add_widget(EntryLabel, text='Level') self.xp = grid1.add_widget(EntryLabel, text='Current XP') self.next_xp = grid1.add_widget(EntryLabel, text='XP Until Level Up') self.cur_hp = grid1.add_widget(EntryLabel, text='Current HP') self.cur_ail = grid1.add_widget(EntryLabel, text='Ailment') self.hold = grid1.add_widget(EntryLabel, text='Hold Item ID') sep3 = ttk.Separator(leftFrm) for entrylabel, int_type in ((self.id, 'u16'), (self.level, 'u16'), (self.xp, 'u32'), (self.next_xp, 'u32'), (self.cur_hp, 'u16'), (self.cur_ail, 'u8'), (self.hold, 'u16')): intValidate(entrylabel.entry, int_type) move_lbl = ttk.Label(moves_frm, text='Moves', style='Subtitle.TLabel') id_lbl = ttk.Label(moves_frm, text='IV') pp_lbl = ttk.Label(moves_frm, text='PP') self.moves_widgets = [] grid2 = WidgetGrid(moves_frm, 2) for _ in range(8): widget = grid2.add_widget(ttk.Entry, justify=tk.CENTER) intValidate(widget, 'u16') self.moves_widgets.append(widget) iv_title = ttk.Label(middleFrm, text='IVs', style='Subtitle.TLabel') self.iv_widgets, grid3 = self.make_base_stats_widget(middleFrm) ev_title = ttk.Label(rightFrm, text='EVs', style='Subtitle.TLabel') self.ev_widgets, grid4 = self.make_base_stats_widget(rightFrm) title.pack() second_row_frm.pack(expand=tk.YES, fill=tk.BOTH) leftFrm.pack( expand=tk.YES, fill=tk.BOTH, side=tk.LEFT, ) grid1.pack(expand=tk.YES, fill=tk.X) sep3.pack(fill=tk.X, padx=(5, 5), pady=(10, 0)) move_lbl.pack() moves_frm.pack(expand=tk.YES, fill=tk.X, padx=(3, 3)) grid2.pack(expand=tk.YES, fill=tk.X, side=tk.BOTTOM) id_lbl.pack(side=tk.LEFT, expand=tk.YES) pp_lbl.pack(side=tk.LEFT, expand=tk.YES) sep1.pack(fill=tk.Y, pady=(5, 5), padx=10, side=tk.LEFT) middleFrm.pack(expand=tk.YES, fill=tk.BOTH, side=tk.LEFT) iv_title.pack() grid3.pack(fill=tk.X) sep2.pack(fill=tk.Y, pady=(5, 5), padx=10, side=tk.LEFT) rightFrm.pack(expand=tk.YES, fill=tk.BOTH, side=tk.LEFT) ev_title.pack() grid4.pack(fill=tk.X)
def __init__(self, parent, controller): ttk.Frame.__init__(self, parent) self.controller = controller self.sidebar = ttk.Frame(self) self.center_side = ttk.Frame(self) self.right_side = ttk.Frame(self) self.image_list = ListChoice(self.sidebar) self.preview = CanvasPlus(self.sidebar, width=1, height=200, borderwidth=2, relief=tk.SUNKEN, background='white') self.frame_select = ttk.Scale(self.center_side, from_=1, to=1, command=self.on_frame_scale_changed) self.frame_label = ttk.Label(self.center_side, text='Frame', style='Title.TLabel') self.canvas = CanvasPlus(self.center_side, width=SIZE[0], height=SIZE[1], highlightthickness=0, background='white') self.length_var = tk.IntVar(self) self.frame_trace = self.length_var.trace_variable( 'w', self.change_length) self.length = EntryLabel(self.right_side, text="Frame Length", entry_variable=self.length_var) intValidate(self.length.entry, 'u16') self.trans_var = tk.IntVar(self) self.transparency = ttk.Scale(self.right_side, from_=0, to=255, command=self.change_transparency) self.transparency_alt = ttk.Entry(self.right_side, width=15, justify=tk.CENTER, textvariable=self.trans_var) intValidate(self.transparency_alt, 'u8') self.apply = ttk.Button(self.right_side, text='Apply', command=self.apply_transparency) self.sidebar.pack(side=tk.LEFT, expand=tk.YES, fill=tk.BOTH) ttk.Label(self.sidebar, text='Images', style='Title.TLabel').pack() self.image_list.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH) self.preview.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH) ttk.Button(self.sidebar, text='Insert Image', command=self.insert_image).pack(pady=(3, 5)) self.center_side.pack(side=tk.LEFT, fill=tk.Y) self.frame_label.pack() self.frame_select.pack(fill=tk.X) self.canvas.pack() self.canvas.bind('<Control-Prior>', self.move_forward) self.canvas.bind('<Control-Next>', self.move_backward) self.canvas.bind('<Prior>', lambda event: self.handle_next(event, False)) self.canvas.bind('<Next>', lambda event: self.handle_next(event, True)) self.canvas.bind('<Delete>', self.on_delete_click) self.canvas.bind('<Control-Button-1>', self.on_ctrl_click) self.canvas.bind('<Control-B1-Motion>', self.on_ctrl_drag) self.canvas.bind('<Button-1>', self.on_left_click) self.canvas.bind('<Button-3>', self.on_right_click) self.canvas.bind('<Up>', lambda event: self.move(Editor.UP)) self.canvas.bind('<Down>', lambda event: self.move(Editor.DOWN)) self.canvas.bind('<Left>', lambda event: self.move(Editor.LEFT)) self.canvas.bind('<Right>', lambda event: self.move(Editor.RIGHT)) self.canvas.bind('<Control-c >', self.copy) self.canvas.bind('<Control-v >', self.paste) self.right_side.pack(side=tk.LEFT, fill=tk.Y) ttk.Label(self.right_side, text='Frame Settings', style='Title.TLabel').pack(pady=(10, 10)) self.length.pack() ttk.Label(self.right_side, text='Selection Transparency').pack(pady=(10, 0)) self.transparency.pack(fill=tk.X, padx=(3, 3)) self.transparency_alt.pack() self.apply.pack(pady=(5, 0)) ttk.Button(self.right_side, text='Preview', command=self.preview_anim).pack(pady=(30, 0)) self.cur_preview = None # Stores current preview image to prevent garbage collection self.outline = None # Stores the current outline object self.copied = None # Stroes a DrawnImage object that was copied # Create the background photo image = Image.open('resources\\layout.png') self.background = ImageTk.PhotoImage(image) self.canvas.create_image(image.size[0] // 2, image.size[1] // 2, image=self.background) self.transparency.set(255) self.toggle_transparency() self.controller.animation.frames.signal_add.connect( self.on_frame_add_or_remove) self.controller.animation.frames.signal_remove.connect( self.on_frame_add_or_remove) self.controller.animation.images.signal_add.connect( self.on_preview_add) self.controller.animation.images.signal_remove.connect( self.on_preview_remove) self.image_list.signal_select.connect(self.on_preview_selected) self.image_list.signal_delete.connect(self.on_preview_deleted) self.controller.editor_model.signal_frame_changed.connect( self.on_frame_change) self.on_frame_change(0)