https://github.com/akascape/tkcurve
A curve line editor widget for tkinter
https://github.com/akascape/tkcurve
curve-generator tkinter tkinter-curve tkinter-gui tkinter-library tkinter-python tkinter-widget tkinter-widgets
Last synced: 2 months ago
JSON representation
A curve line editor widget for tkinter
- Host: GitHub
- URL: https://github.com/akascape/tkcurve
- Owner: Akascape
- License: mit
- Created: 2024-05-03T15:52:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-04T12:27:05.000Z (about 1 year ago)
- Last Synced: 2024-05-21T03:35:38.140Z (about 1 year ago)
- Topics: curve-generator, tkinter, tkinter-curve, tkinter-gui, tkinter-library, tkinter-python, tkinter-widget, tkinter-widgets
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# TkCurve
A curve editor widget for tkinter, can be used in complex programs for better controls.
## Installation
### [](https://github.com/Akascape/TkCurve/archive/refs/heads/main.zip)
Download the source code, paste the `tkcurve` folder in the directory where your program is present.
## Usage
```python
import tkinter as tk
from tkcurve import CurveWidgetroot = tk.Tk()
root.config(bg="black")values = [(300,0), (150,150), (0,300)]
curve_widget = CurveWidget(root, values, line_color="purple",
point_color="white", outline="black")
curve_widget.pack(side="left", padx=10, pady=10)values2 = [(300,0), (150,150), (0,300)]
curve_widget2 = CurveWidget(root, values2)
curve_widget2.pack(side="left", padx=10, pady=10)values3 = [(300,0), (200,200), (75, 75), (0,300)]
curve_widget3 = CurveWidget(root, values3, line_color="green")
curve_widget3.pack(side="left", padx=10, pady=10)root.mainloop()
```## Parameters
| Parameters | Details |
|--------|----------|
| master | parent widget |
| width | width of the canvas |
| height | height of the canvas |
| points | the values of the points, example: [(x,y), (x,y)] |
| point_color | color of the points |
| point_size | radius of the points |
| line_color | color of the curve line |
| line_width | width of the line |
| bg | background color |
| smooth | enable/disable bezier curve |
| grid_color | color of the grid lines |## Methods
- `.add_point((x,y))`: add a new point in the canvas
- `.delete_point((x,y))`: delete a point from canvas
- `.fix((x,y))`: fix a point in the canvas
- `.config`: change any of the parameters
- `.cget`: get any parameter
- `.get()`: get the current points
Follow me for more stuff like this: [`Akascape`](https://github.com/Akascape/)