class AlexLabelTest(AbstractComponentTest): def __init__(self): super().__init__() self.name = "Alex label test" def test_component(self, master, message_label): self.message_label = message_label self.master = master self.label1 = AlexLabel(master) self.label1.set('Label text:') self.label1.grid(row=0, column=0) self.entry1 = AlexEntry(master) self.entry1.set("Enter label text") self.entry1.grid(row=0, column=1) AlexButton(master, text='Set label text', command=self._set_label_text).grid(row=1, column=0) AlexButton(master, text='Set entry from label', command=self._set_entry_from_label).grid(row=1, column=1) def _set_label_text(self): self.label1.set(self.entry1.get()) self.entry1.set('') def _set_entry_from_label(self): self.entry1.set(self.label1.get())
def config_dialog(self, event_list=[], date=None): self.label.set( _("Events exist on %s. Please select the event you want or create a new one" ) % date) if self.event_frame is not None: self.event_frame.destroy() self.event_frame = Frame(self.interior) self.event_frame.pack() row_counter = 0 for event in event_list: description = AlexLabel(self.event_frame, wraplength=500, justify=LEFT, text=event.description) description.grid(row=row_counter, column=0, sticky=W) def closure(event): return lambda: self._set_return_value(event) button = AlexButton(self.event_frame, text=_("Goto event"), command=closure(event)) button.grid(row=row_counter, column=1) row_counter += 1
def test_component(self, master, message_label): self.message_label = message_label self.master = master label1 = AlexLabel(master) label1.set('Entry 1:') label1.grid(row=0, column=0) self.entry1 = AlexEntry(master) self.entry1.set("Entry 1 text") self.entry1.grid(row=0, column=1) label2 = AlexLabel(master) label2.set('Entry 2:') label2.grid(row=1, column=0) self.entry2 = AlexEntry(master) self.entry2.set("Entry 2 text") self.entry2.grid(row=1, column=1) AlexButton(master, text='Switch input', command=self._switch_input).grid(row=2, column=1)