def init_ui(self): super().init_ui() label_x = widgets.Label(20, 0, 0, 0, parent=self.frame) label_x.top = 40 label_x.lab.color = (120, 120, 120, 255) label_x.text = 'X:' self.entry_x = widgets.FloatEntry(40, 0, 140, 30, self.frame) self.entry_x.top = 20 label_y = widgets.Label(20, 0, 0, 0, parent=self.frame) label_y.top = 80 label_y.lab.color = (120, 120, 120, 255) label_y.text = 'Y:' self.entry_y = widgets.FloatEntry(40, 0, 140, 30, self.frame) self.entry_y.top = 60 self.submit_bt = widgets.Button( x=20, y=20, w=160, h=30, parent=self.frame, command=self.submit, text='Adicionar') self.submit_bt.label.lab.color = (50, 50, 50, 255) self.is_visible = False self.frame.add(label_x) self.frame.add(self.entry_x) self.frame.add(label_y) self.frame.add(self.entry_y) self.frame.add(self.submit_bt)
def init_ui(self): super().init_ui() self.list_viewer = widgets.List(12, 54, 262, 84, self.frame) self.close_bt = widgets.Button(x=12, y=12, w=100, h=30, parent=self.frame, command=self.close, text='Fechar') self.add_bt = widgets.Button(x=124, y=12, w=150, h=30, parent=self.frame, text='Adicionar força') self.close_bt.label.lab.color = (50, 50, 50, 255) self.add_bt.label.lab.color = (50, 50, 50, 255) self.is_visible = False
def add_button(self, name, command): bt = widgets.Button( x=0, y=0, w=70, h=28, text=name, command=command) bt.max_width = 70 bt.max_height = 28 bt.min_height = 28 bt.label.lab.color = (255, 255, 255, 150) bt.null_color = (0, 0, 0, 0) bt.color = (0, 0, 0, 0) bt.border_color = (0, 0, 0, 0) bt.border_radius = 0 self.add(bt)
def add_dropdown(self, name, options): pos_x = len(self.elements) * 70 dropdown = Dropdown(4, 0, 120, 0) dropdown.is_visible = False dropdown.margin_top = 34 for i, (op_name, command) in enumerate(options): bt = widgets.Button( x=0, y=0, w=140, h=28, text=op_name, command=command) bt.null_color = (0, 0, 0, 0) bt.pressed_color = (0.1, 0.8, 1, 0.4) bt.color = (0, 0, 0, 0) bt.border_color = (0, 0, 0, 0) dropdown.add(bt) self.add_button(name, command=dropdown.toggle_is_visible) return dropdown
def init_ui(self): super().init_ui() label_pos_x = widgets.Label(0, 0, 0, 16) label_pos_x.lab.color = (200, 200, 200, 255) label_pos_x.text = 'Posição X:' self.entry_pos_x = widgets.FloatEntry(0, 0, 130, 30) label_pos_y = widgets.Label(8, 0, 0, 16) label_pos_y.lab.color = (200, 200, 200, 255) label_pos_y.text = 'Posição Y:' self.entry_pos_y = widgets.FloatEntry(0, 0, 130, 30) label_vel_x = widgets.Label(0, 0, 0, 16) label_vel_x.lab.color = (200, 200, 200, 255) label_vel_x.text = 'Velocidade X:' self.entry_vel_x = widgets.FloatEntry(0, 0, 130, 30) label_vel_y = widgets.Label(0, 0, 0, 16) label_vel_y.lab.color = (200, 200, 200, 255) label_vel_y.text = 'Velocidade Y:' self.entry_vel_y = widgets.FloatEntry(0, 0, 130, 30) # self.edit_forces_bt = widgets.Button(12, 12, 110, 32, # text='Forças', command=self.close) # self.edit_forces_bt.label.lab.color = (50, 50, 50, 255) self.submit_bt = widgets.Button(12, 12, 110, 32, text='Confirmar', command=self.close) self.submit_bt.label.lab.color = (50, 50, 50, 255) self.frame.add(label_pos_x) self.frame.add(self.entry_pos_x) self.frame.add(label_pos_y) self.frame.add(self.entry_pos_y) self.frame.add(label_vel_x) self.frame.add(self.entry_vel_x) self.frame.add(label_vel_y) self.frame.add(self.entry_vel_y) # self.frame.add(self.edit_forces_bt) self.frame.add(self.submit_bt) label_pos_x.top = 8 label_pos_x.x = 12 self.entry_pos_x.top = 32 self.entry_pos_x.x = 12 label_pos_y.top = 8 label_pos_y.x = 162 self.entry_pos_y.top = 32 self.entry_pos_y.x = 162 label_vel_x.top = 78 label_vel_x.x = 12 self.entry_vel_x.top = 102 self.entry_vel_x.x = 12 label_vel_y.top = 78 label_vel_y.x = 162 self.entry_vel_y.top = 102 self.entry_vel_y.x = 162 self.is_visible = False