/digital_whiteboard

This Python script creates a simple whiteboard application with a graphical interface using the tkinter library.

Primary LanguagePython

Digital Whiteboard


Digital Whiteboard


This Python script creates a simple whiteboard application with a graphical interface using the tkinter library. The application allows the user to draw lines on a virtual whiteboard, choose pen colors, import images and adjust line thickness with a slider. Here is a description of the main parts of the script:

Library Import:

The script starts by importing several tkinter libraries to create the graphical interface, manipulate colors, work with files, and perform other graphical tasks.

Main Window Configuration:

A main window is created using tk.Tk(), with a title ("WHITE BOARD"), fixed size and background color set.

Drawing Manipulation Functions

. locate_xy(event): Records the mouse coordinates when the button is pressed.

. addline(event): Draws a line on the screen between the previously recorded coordinates and the current mouse coordinates.

. show_color(new_color): Updates the pen color.

. new_canvas(): Cleans the whiteboard, removing all drawings.

. insertimage(): Allows the user to select and insert an image into the whiteboard, which can be dragged.

. my_callback(event): Moves the inserted image to the mouse position when the right mouse button is pressed and dragged.

Icons and Graphical Interface

. Icons and buttons are added to the main window for functions such as clearing the whiteboard and importing images.

. A color palette is displayed in the left part of the window, allowing the user to choose the pen color.

Main screen

. A canvas (Canvas) is created in the center of the main window, where the user can draw.

. Mouse events (click and drag) are linked to drawing functions.

Main Loop

The main loop (root.mainloop()) is started to run the GUI and wait for user interaction.

In summary, this script creates a simple whiteboard application with basic drawing features, image import, and control of drawing line color and thickness. It's a great base for building a more complex painting or note-taking application.

Contributions

Contributions are welcome! If you want to improve the project, add new features or fix problems, feel free.