def add_buttons(self):
        cfg.create_button(self.frame_buttons, 'НАРИСОВАТЬ', FONT, 0, 0, PADX,
                          PADY, 1, 'WE', self.draw_func)
        cfg.create_button(self.frame_buttons, 'ОЧИСТИТЬ ХОЛСТ', FONT, 1, 0,
                          PADX, PADY, 1, 'WE', self.canvas.delete_all)

        self.frame_buttons.grid(row=4, column=1, padx=5, pady=5, sticky=tk.N)
예제 #2
0
 def add_section(self):
     cfg.create_label(self.frame_section, 'ВВОД ОТРЕЗКОВ', FONT_BOLD, 0, 0,
                      PADX, PADY, tk.N, 'groove')
     cfg.create_label(self.frame_section, 'Координаты отрезка', FONT_BOLD,
                      1, 0, PADX, 1, tk.N)
     self.section_coors = cfg.create_entry(self.frame_section, FONT, 2, 0,
                                           PADX, PADY, tk.N)
     cfg.create_button(self.frame_section, 'ВВЕСТИ', FONT, 3, 0, PADX, PADY,
                       1, 'WE', self.create_section)
     self.frame_section.grid(row=1, column=1, padx=5, pady=5, sticky=tk.N)
예제 #3
0
 def add_color(self):
     cfg.create_label(self.frame_color, 'Выберите цвет', FONT_BOLD, 0, 0,
                      PADX, PADY, tk.N, 'groove')
     for i, color in enumerate(cfg.colors):
         cfg.create_radiobutton(self.frame_color, self.color, i, color,
                                FONT, i + 1, 0, PADX, 0, 'WN')
     cfg.create_button(self.frame_color, 'Поменять цвет', FONT, 7, 0, PADX,
                       0, 1, 'WE', self.change_color)
     cfg.create_label(self.frame_color, '(Холст будет очищен)', 'Times 10',
                      8, 0, PADX, 0, tk.N)
     self.frame_color.grid(row=1, column=1, padx=5, pady=5, sticky=tk.N)
 def add_section(self):
     cfg.create_label(self.frame_section, 'ВВОД ОТРЕЗКОВ', FONT_BOLD, 0, 0,
                      PADX, PADY, tk.N, 'groove')
     cfg.create_label(
         self.frame_section,
         'Координаты отрезка\n(или ЛКМ,\nверт./гориз. - +Ctrl,\n'
         'параллельные - +Shift)', FONT_BOLD, 1, 0, PADX, 1, tk.N)
     self.section_coors = cfg.create_entry(self.frame_section, FONT, 2, 0,
                                           PADX, PADY, tk.N)
     cfg.create_button(self.frame_section, 'ВВЕСТИ', FONT, 3, 0, PADX, PADY,
                       1, 'WE', self.create_section)
     self.frame_section.grid(row=1, column=1, padx=5, pady=5, sticky=tk.N)
예제 #5
0
 def add_cutter(self):
     cfg.create_label(self.frame_cutter, 'ВВОД ОТСЕКАТЕЛЯ', FONT_BOLD, 0, 0,
                      PADX, PADY, tk.N, 'groove')
     cfg.create_label(
         self.frame_cutter,
         'Координаты границ\nв формате "левая\nнижняя правая верхняя"',
         FONT_BOLD, 1, 0, PADX, 1, tk.N)
     self.cutter_coors = cfg.create_entry(self.frame_cutter, FONT, 2, 0,
                                          PADX, PADY, tk.N)
     cfg.create_button(self.frame_cutter, 'ВВЕСТИ', FONT, 3, 0, PADX, PADY,
                       1, 'WE', self.create_cutter)
     self.frame_cutter.grid(row=0, column=1, padx=5, pady=5, sticky=tk.N)
예제 #6
0
    def add_input(self):
        text = 'Введите координаты\nдля следующей\nточки через пробел\n(либо сделайте\nэто мышью)\n' \
               '(Зажатый Ctrl - \nпрямые отрезки)'

        cfg.create_label(self.frame_input, text, FONT_BOLD, 0, 0, PADX, PADY,
                         tk.N, 'groove')
        entry_coors = cfg.create_entry(self.frame_input, FONT, 1, 0, PADX,
                                       PADY, tk.N)
        cfg.create_button(self.frame_input, 'Добавить', FONT, 2, 0, PADX, PADY,
                          1, 'WE', self.draw_point)
        self.coors = entry_coors
        self.frame_input.grid(row=0, column=1, padx=5, pady=5, sticky=tk.N)
 def add_cutter(self):
     cfg.create_label(self.frame_cutter, 'ВВОД ОТСЕКАТЕЛЯ', FONT_BOLD, 0, 0,
                      PADX, PADY, tk.N, 'groove')
     cfg.create_label(
         self.frame_cutter,
         'Очередная вершина\n(или ПКМ, \nверт./гориз. - +Ctrl)', FONT_BOLD,
         1, 0, PADX, 1, tk.N)
     self.cutter_coors = cfg.create_entry(self.frame_cutter, FONT, 2, 0,
                                          PADX, PADY, tk.N)
     cfg.create_button(self.frame_cutter, 'ДОБАВИТЬ', FONT, 3, 0, PADX,
                       PADY, 1, 'WE', self.create_cutter)
     cfg.create_button(self.frame_cutter, 'ЗАМКНУТЬ', FONT, 4, 0, PADX,
                       PADY, 1, 'WE', self.canvas.end_cutter)
     self.frame_cutter.grid(row=0, column=1, padx=5, pady=5, sticky=tk.N)
    def add_color(self):
        cfg.create_label(self.frame_color, 'ЦВЕТ: ', FONT_BOLD, 0, 0, PADX,
                         PADY, tk.N, 'groove')
        self.color_win = cfg.create_button(self.frame_color, '', FONT, 1, 0,
                                           PADX, 0, 1, 'WE', self.choose_color,
                                           self.color)

        self.frame_color.grid(row=0, column=1, padx=5, pady=5, sticky=tk.N)
    def add_limits(self):
        cfg.create_label(self.frame_limits, 'ПРЕДЕЛЫ', FONT_BOLD, 0, 0, PADX,
                         PADY, tk.N, 'groove', 4)
        cfg.create_label(self.frame_limits, 'ОТ', FONT, 1, 1, 0, 0, tk.N,
                         'groove')
        cfg.create_label(self.frame_limits, 'ДО', FONT, 1, 2, 0, 0, tk.N,
                         'groove')
        cfg.create_label(self.frame_limits, 'ШАГ', FONT, 1, 3, 0, 0, tk.N,
                         'groove')

        cfg.create_label(self.frame_limits, 'ПО Х:', FONT, 2, 0, 0, 0, tk.N,
                         'groove')
        self.dx.append(
            cfg.create_entry(self.frame_limits, FONT, 2, 1, PADX, PADY, tk.N,
                             4))
        self.dx[0].insert(0, '-10')
        self.dx.append(
            cfg.create_entry(self.frame_limits, FONT, 2, 2, PADX, PADY, tk.N,
                             4))
        self.dx[1].insert(0, '10')
        self.dx.append(
            cfg.create_entry(self.frame_limits, FONT, 2, 3, PADX, PADY, tk.N,
                             4))
        self.dx[2].insert(0, '0.1')

        cfg.create_label(self.frame_limits, 'ПО Y:', FONT, 3, 0, 0, 0, tk.N,
                         'groove')
        self.dz.append(
            cfg.create_entry(self.frame_limits, FONT, 3, 1, PADX, PADY, tk.N,
                             4))
        self.dz[0].insert(0, '-10')
        self.dz.append(
            cfg.create_entry(self.frame_limits, FONT, 3, 2, PADX, PADY, tk.N,
                             4))
        self.dz[1].insert(0, '10')
        self.dz.append(
            cfg.create_entry(self.frame_limits, FONT, 3, 3, PADX, PADY, tk.N,
                             4))
        self.dz[2].insert(0, '0.1')

        cfg.create_button(self.frame_limits, 'ПРИМЕНИТЬ', 'Times 10', 4, 0,
                          PADX, PADY, 4, 'WE', self.change_limits)

        self.frame_limits.grid(row=2, column=1, padx=5, pady=5, sticky=tk.N)
    def add_color(self):
        cfg.create_label(self.frame_color, 'ЦВЕТ ОТСЕКАТЕЛЯ: ', FONT_BOLD, 0,
                         0, PADX, 4, tk.N, 'groove')
        self.color_wins['cutter'] = cfg.create_button(
            self.frame_color, '', FONT, 1, 0, PADX, 0, 4, 'WE',
            lambda: self.choose_color('cutter'), self.colors['cutter'])

        cfg.create_label(self.frame_color, 'ЦВЕТ ОТРЕЗКОВ: ', FONT_BOLD, 2, 0,
                         PADX, 4, tk.N, 'groove')
        self.color_wins['section'] = cfg.create_button(
            self.frame_color, '', FONT, 3, 0, PADX, 0, 4, 'WE',
            lambda: self.choose_color('section'), self.colors['section'])

        cfg.create_label(self.frame_color, 'ЦВЕТ РЕЗУЛЬТАТА: ', FONT_BOLD, 4,
                         0, PADX, 4, tk.N, 'groove')
        self.color_wins['result'] = cfg.create_button(
            self.frame_color, '', FONT, 5, 0, PADX, 0, 4, 'WE',
            lambda: self.choose_color('result'), self.colors['result'])

        self.frame_color.grid(row=2, column=1, padx=5, pady=5, sticky=tk.N)
    def add_entry(self):
        cfg.create_label(self.frame_entries, 'ПОВОРОТ ВОКРУГ ОСЕЙ', FONT_BOLD,
                         0, 0, PADX, PADY, tk.N, 'groove', 3)

        cfg.create_label(self.frame_entries, 'ПО Х:', FONT, 1, 0, PADX, PADY,
                         tk.N)
        self.ox = cfg.create_entry(self.frame_entries, FONT, 1, 1, PADX, PADY,
                                   tk.N, 5)
        self.ox.insert(0, '0')
        cfg.create_button(self.frame_entries, 'ПРИМЕНИТЬ', 'Times 10', 1, 2,
                          PADX, PADY, 1, 'WE', self.canvas.rotate_x)

        cfg.create_label(self.frame_entries, 'ПО Y:', FONT, 2, 0, PADX, PADY,
                         tk.N)
        self.oy = cfg.create_entry(self.frame_entries, FONT, 2, 1, PADX, PADY,
                                   tk.N, 5)
        self.oy.insert(0, '0')
        cfg.create_button(self.frame_entries, 'ПРИМЕНИТЬ', 'Times 10', 2, 2,
                          PADX, PADY, 1, 'WE', self.canvas.rotate_y)

        cfg.create_label(self.frame_entries, 'ПО Z:', FONT, 3, 0, PADX, PADY,
                         tk.N)
        self.oz = cfg.create_entry(self.frame_entries, FONT, 3, 1, PADX, PADY,
                                   tk.N, 5)
        self.oz.insert(0, '0')
        cfg.create_button(self.frame_entries, 'ПРИМЕНИТЬ', 'Times 10', 3, 2,
                          PADX, PADY, 1, 'WE', self.canvas.rotate_z)

        ttk.Separator(self.frame_entries,
                      orient='horizontal').grid(row=4,
                                                column=0,
                                                columnspan=3,
                                                pady=8,
                                                sticky='WE')
        cfg.create_label(self.frame_entries, 'МАСШТАБИРОВАНИЕ', FONT_BOLD, 5,
                         0, PADX, PADY, tk.N, 'groove', 3)

        cfg.create_label(self.frame_entries, 'K:', FONT, 6, 0, PADX, PADY,
                         tk.N)
        self.scale = cfg.create_entry(self.frame_entries, FONT, 6, 1, PADX,
                                      PADY, tk.N, 5)
        self.scale.insert(0, '50')
        cfg.create_button(self.frame_entries, 'ПРИМЕНИТЬ', 'Times 10', 6, 2,
                          PADX, PADY, 1, 'WE', self.draw_func)

        self.frame_entries.grid(row=3, column=1, padx=5, pady=5, sticky=tk.N)
    def add_buttons(self):
        cfg.create_button(
            self.frame_buttons, 'ОТСЕЧЬ', FONT, 0, 0, PADX, PADY, 1, 'WE',
            lambda: alg.cyrus_beck_cut(self.canvas, self.cutter, self.section))

        cfg.create_button(self.frame_buttons, 'ОЧИСТИТЬ ХОЛСТ', FONT, 1, 0,
                          PADX, PADY, 1, 'WE', self.canvas.delete_all)
        cfg.create_button(self.frame_buttons, 'ИЗМЕРИТЬ ВРЕМЯ', FONT, 6, 0,
                          PADX, PADY, 1, 'WE', self.count_time)

        self.frame_buttons.grid(row=3, column=1, padx=5, pady=5, sticky=tk.N)
예제 #13
0
    def add_buttons(self):
        cfg.create_button(self.frame_buttons, 'Замкнуть фигуру', FONT, 0, 0,
                          PADX, PADY, 1, 'WE', self.canvas.end_draw)
        cfg.create_button(self.frame_buttons, 'Очистить холст', FONT, 1, 0,
                          PADX, PADY, 1, 'WE', self.canvas.delete_all)
        cfg.create_button(
            self.frame_buttons, 'Закрасить фигуру', FONT, 2, 0, PADX, PADY, 1,
            'WE', lambda: alg.algorithm_partition(
                self.canvas, False if self.mode.get() == 0 else True))

        cfg.create_radiobutton(self.frame_buttons, self.mode, 0,
                               'Без задержки', FONT, 3, 0, PADX, PADY, 'WN')
        cfg.create_radiobutton(self.frame_buttons, self.mode, 1, 'C задержкой',
                               FONT, 4, 0, PADX, PADY, 'WN')

        cfg.create_button(self.frame_buttons, 'Измерить время', FONT, 5, 0,
                          PADX, PADY, 1, 'WE', self.count_time)

        self.frame_buttons.grid(row=2, column=1, padx=5, pady=5, sticky=tk.N)