mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
readme wiki
This commit is contained in:
parent
44e50e751e
commit
d9480d7fef
169
Readme.md
169
Readme.md
@ -11,4 +11,171 @@ CustomTkinter also supports a light and dark theme,
|
|||||||
which can either be set manually or get controlled by
|
which can either be set manually or get controlled by
|
||||||
the system appearance mode (only macOS).
|
the system appearance mode (only macOS).
|
||||||
|
|
||||||
Detailed documentation is coming soon....
|
## Ui-Elements
|
||||||
|
|
||||||
|
### CTkButton
|
||||||
|
Examle Code:
|
||||||
|
```python
|
||||||
|
def button_event():
|
||||||
|
print("button pressed")
|
||||||
|
|
||||||
|
button = customtkinter.CTkButton(master=root_tk,
|
||||||
|
text="CTkButton",
|
||||||
|
command=button_event,
|
||||||
|
width=120,
|
||||||
|
height=32,
|
||||||
|
border_width=0,
|
||||||
|
corner_radius=8)
|
||||||
|
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
```
|
||||||
|
<details>
|
||||||
|
<summary>Show all arguments:</summary>
|
||||||
|
|
||||||
|
argument | value
|
||||||
|
--- | ---
|
||||||
|
master | root, tkinter.Frame or CTkFrame
|
||||||
|
text | string
|
||||||
|
command | callback function
|
||||||
|
width | button width in px
|
||||||
|
height | button height in px
|
||||||
|
corner_radius | corner radius in px
|
||||||
|
border_width | button border width in px
|
||||||
|
fg_color | forground color, tuple: (light_color, dark_color) or single color
|
||||||
|
bg_color | background color, tuple: (light_color, dark_color) or single color
|
||||||
|
border_color | border color, tuple: (light_color, dark_color) or single color
|
||||||
|
hover_color | hover color, tuple: (light_color, dark_color) or single color
|
||||||
|
text_color | text color, tuple: (light_color, dark_color) or single color
|
||||||
|
text_font | button text font, tuple: (font_name, size)
|
||||||
|
hover | enable/disable hover effect: True, False
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### CTkLabel
|
||||||
|
Example Code:
|
||||||
|
```python
|
||||||
|
button = customtkinter.CTkButton(master=root_tk,
|
||||||
|
text="CTkLabel",
|
||||||
|
width=120,
|
||||||
|
height=25,
|
||||||
|
corner_radius=8)
|
||||||
|
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
```
|
||||||
|
<details>
|
||||||
|
<summary>Show all arguments:</summary>
|
||||||
|
|
||||||
|
argument | value
|
||||||
|
--- | ---
|
||||||
|
master | root, tkinter.Frame or CTkFrame
|
||||||
|
text | string
|
||||||
|
width | label width in px
|
||||||
|
height | label height in px
|
||||||
|
corner_radius | corner radius in px
|
||||||
|
fg_color | forground color, tuple: (light_color, dark_color) or single color
|
||||||
|
bg_color | background color, tuple: (light_color, dark_color) or single color
|
||||||
|
text_color | label text color, tuple: (light_color, dark_color) or single color
|
||||||
|
text_font | label text font, tuple: (font_name, size)
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### CTkEntry
|
||||||
|
Example Code:
|
||||||
|
```python
|
||||||
|
entry = customtkinter.CTkEntry(master=root_tk,
|
||||||
|
width=120,
|
||||||
|
height=25,
|
||||||
|
corner_radius=10)
|
||||||
|
entry.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
|
||||||
|
text = entry.get()
|
||||||
|
```
|
||||||
|
<details>
|
||||||
|
<summary>Show all arguments:</summary>
|
||||||
|
|
||||||
|
argument | value
|
||||||
|
--- | ---
|
||||||
|
master | root, tkinter.Frame or CTkFrame
|
||||||
|
width | entry width in px
|
||||||
|
height | entry height in px
|
||||||
|
corner_radius | corner radius in px
|
||||||
|
fg_color | forground color, tuple: (light_color, dark_color) or single color
|
||||||
|
bg_color | background color, tuple: (light_color, dark_color) or single color
|
||||||
|
text_color | entry text color, tuple: (light_color, dark_color) or single color
|
||||||
|
text_font | entry text font, tuple: (font_name, size)
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### CTkSlider
|
||||||
|
Example Code:
|
||||||
|
```python
|
||||||
|
def slider_event(value):
|
||||||
|
print(value)
|
||||||
|
|
||||||
|
slider = customtkinter.CTkSlider(master=root_tk,
|
||||||
|
width=160,
|
||||||
|
height=16,
|
||||||
|
border_width=5.5,
|
||||||
|
command=slider_event)
|
||||||
|
slider.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
```
|
||||||
|
<details>
|
||||||
|
<summary>Show all arguments:</summary>
|
||||||
|
|
||||||
|
argument | value
|
||||||
|
--- | ---
|
||||||
|
master | root, tkinter.Frame or CTkFrame
|
||||||
|
command | callback function, gest called when slider gets changed
|
||||||
|
width | slider width in px
|
||||||
|
height | slider height in px
|
||||||
|
border_width | space around the slider rail in px
|
||||||
|
fg_color | forground color, tuple: (light_color, dark_color) or single color
|
||||||
|
bg_color | background color, tuple: (light_color, dark_color) or single color
|
||||||
|
border_color | slider border color, normally transparent (None)
|
||||||
|
button_color | color of the slider button, tuple: (light_color, dark_color) or single color
|
||||||
|
button_hover_color | hover color, tuple: (light_color, dark_color) or single color
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### CTkProgressBar
|
||||||
|
Example Code:
|
||||||
|
```python
|
||||||
|
progressbar = customtkinter.CTkSlider(master=root_tk,
|
||||||
|
width=160,
|
||||||
|
height=20,
|
||||||
|
border_width=5)
|
||||||
|
progressbar.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
|
||||||
|
progressbar.set(value)
|
||||||
|
```
|
||||||
|
<details>
|
||||||
|
<summary>Show all arguments:</summary>
|
||||||
|
|
||||||
|
argument | value
|
||||||
|
--- | ---
|
||||||
|
master | root, tkinter.Frame or CTkFrame
|
||||||
|
width | slider width in px
|
||||||
|
height | slider height in px
|
||||||
|
border_width | border width in px
|
||||||
|
fg_color | forground color, tuple: (light_color, dark_color) or single color
|
||||||
|
bg_color | background color, tuple: (light_color, dark_color) or single color
|
||||||
|
border_color | slider border color, tuple: (light_color, dark_color) or single color
|
||||||
|
progress_color | progress color, tuple: (light_color, dark_color) or single color
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### CTkFrame
|
||||||
|
Example Code:
|
||||||
|
```python
|
||||||
|
frame = customtkinter.CTkSlider(master=root_tk,
|
||||||
|
width=200,
|
||||||
|
height=200,
|
||||||
|
corner_radius=10)
|
||||||
|
frame.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
||||||
|
```
|
||||||
|
<details>
|
||||||
|
<summary>Show all arguments:</summary>
|
||||||
|
|
||||||
|
argument | value
|
||||||
|
--- | ---
|
||||||
|
master | root, tkinter.Frame or CTkFrame
|
||||||
|
width | slider width in px
|
||||||
|
height | slider height in px
|
||||||
|
fg_color | forground color, tuple: (light_color, dark_color) or single color
|
||||||
|
bg_color | background color, tuple: (light_color, dark_color) or single color
|
||||||
|
</details>
|
||||||
|
|
||||||
|
#
|
@ -9,8 +9,8 @@ class CTkFrame(tkinter.Frame):
|
|||||||
bg_color=None,
|
bg_color=None,
|
||||||
fg_color=None,
|
fg_color=None,
|
||||||
corner_radius=10,
|
corner_radius=10,
|
||||||
width=50,
|
width=200,
|
||||||
height=20,
|
height=200,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ class CTkProgressBar(tkinter.Frame):
|
|||||||
border_color=None,
|
border_color=None,
|
||||||
fg_color=CTkColorManager.PROGRESS_BG,
|
fg_color=CTkColorManager.PROGRESS_BG,
|
||||||
progress_color=CTkColorManager.MAIN,
|
progress_color=CTkColorManager.MAIN,
|
||||||
function=None,
|
|
||||||
width=160,
|
width=160,
|
||||||
height=20,
|
height=20,
|
||||||
border_width=5,
|
border_width=5,
|
||||||
@ -46,8 +45,6 @@ class CTkProgressBar(tkinter.Frame):
|
|||||||
height=self.height)
|
height=self.height)
|
||||||
self.canvas.place(x=0, y=0)
|
self.canvas.place(x=0, y=0)
|
||||||
|
|
||||||
self.function = function
|
|
||||||
|
|
||||||
self.border_parts = []
|
self.border_parts = []
|
||||||
self.fg_parts = []
|
self.fg_parts = []
|
||||||
self.progress_parts = []
|
self.progress_parts = []
|
||||||
|
Loading…
Reference in New Issue
Block a user