tools module

class tools.TextInsertWindow(app, *args, **kwargs)[source]

Bases: CTkFrame

Custom Widget that handles the insertion of text items into the canvas.

check_if_overlay()[source]

Decorator that checks if the current active canvas is the base canvas or the overlay canvas.

handle_insert_text_btn(event=None)[source]

Inserts the text from the widget onto the canvas.

Parameters:

event (tkinter.Event) –

Returns:

None

hide_text_insert_window()[source]

Hides the text_insert_window widget.

Returns:

None

new_font_pixel_size = -50
on_combobox_select(choice)[source]

Called on selecting an option from the dropdown combobox.

Parameters:

choice (str) – Name of the font.

Returns:

None

on_listbox_select(event=0, file_name=None)[source]

Called on selecting a font name from the listbox. Assigns the Text font as the selected font.

Parameters:
  • event (tkinter.Event,optional) – Mouse click event.

  • file_name (str,optional) – Font filename to use.

Returns:

None

populate_listbox()[source]

Loads the fonts from the ‘fonts’ folder in the program directory and lists the fonts in the widget list box. :returns: None

reset_font_size()[source]

Resets the current font size to the default size.

Returns:

None

reveal_text_insert_window(event=None)[source]

Displays the text_insert_window widget.

Parameters:

event (tkinter.Event,optional) –

Returns:

None

selected_font = ''
selected_font_file = ''
selected_font_index = 0
selected_font_size = -50
stored_text_position = None
stored_text_size: int = None
text_insert_layout()[source]

Creates the text insert widget. :returns: None

class tools.Tools(app, canvas, graphics_manager)[source]

Bases: object

Class that handles the different tools in the main app.

brush_tool()[source]

Activates the brush tool.

Returns:

None

color_picker_tool()[source]

Activates the Color Picker tool. :returns: None

create_tool_button_dict()[source]

Creates a dictionary consisting of the tool index as keys and the buttons as values. For ease of configuring the buttons. :returns: None

current_tool = 1
cursor_tool()[source]

Activates the Cursor tool.

Returns:

None

decimate_factor = 1.5
disable_all_modifiers()[source]

Sets the state of all modifier checkbox to ‘disabled’.

Returns:

None

disable_all_tool_buttons()[source]

Sets the state of all tool buttons to ‘disabled’.

Returns:

None

enable_all_tool_buttons()[source]

Sets the state of all tool buttons to normal. :returns: None

endcap = 'round'
eraser_tool()[source]

Activates the Eraser tool.

Returns:

None

fill_color = '#FF0000'
fill_color_checkbox_handler()[source]

Gets the state of the fill checkbox and sets the shape_fill variable accordingly.

Returns:

None

flat_cap_checkbox_handler()[source]

Gets the state of the flatcap checkbox and sets the endcap variable accordingly.

Returns:

None

highlight_checkbox_handler()[source]

Gets the state of the highlight checkbox and sets the stipple variable accordingly.

Returns:

None

line_tool()[source]

Activates the Line tool.

Returns:

None

oval_tool()[source]

Activates the Oval tool.

Returns:

None

pan_tool()[source]

Activates the Pan tool.

Returns:

None

previous_tool = 0
rectangle_tool()[source]

Activates the Rectangle tool.

Returns:

None

reset_tool_variables()[source]

Resets all tool variables like width, fill, constraint to the default state. Returns:

select_tool_button()[source]

Decorator that handles the switch to a new tool.

shape_constraint = False
shape_fill = False
stipple = ''
stroke_width = 10
text_color_tool()[source]

Activates the Text color tool.

Returns:

None

text_tool()[source]

Activates the Text tool.

Returns:

None

uniform_shape_checkbox_handler()[source]

Gets the state of the uniform checkbox and sets the shape_constraint variable accordingly.

Returns:

None