Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nse-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mary Kuzmichova
nse-gui
Commits
88aba049
Commit
88aba049
authored
10 months ago
by
Maryshca
Browse files
Options
Downloads
Patches
Plain Diff
rm ctk files
parent
b006a327
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
configeditor.py
+0
-124
0 additions, 124 deletions
configeditor.py
configeditor2.py
+0
-96
0 additions, 96 deletions
configeditor2.py
ctk.py
+0
-245
0 additions, 245 deletions
ctk.py
with
0 additions
and
465 deletions
configeditor.py
deleted
100644 → 0
+
0
−
124
View file @
b006a327
import
customtkinter
as
ctk
from
tkinter
import
filedialog
from
tkinter
import
messagebox
import
json
ctk
.
set_appearance_mode
(
"
System
"
)
ctk
.
set_default_color_theme
(
"
blue
"
)
class
ConfigEditor
:
def
__init__
(
self
,
root
):
self
.
root
=
root
self
.
root
.
title
(
"
Config File Editor
"
)
self
.
config_data
=
{}
self
.
open_button
=
ctk
.
CTkButton
(
self
.
root
,
text
=
"
Open Config File
"
,
command
=
self
.
open_file
)
self
.
open_button
.
pack
(
pady
=
20
)
def
open_file
(
self
):
file_path
=
filedialog
.
askopenfilename
(
filetypes
=
[(
"
Config Files
"
,
"
*.txt
"
),
(
"
All Files
"
,
"
*.*
"
)])
if
file_path
:
try
:
with
open
(
file_path
,
'
r
'
)
as
file
:
self
.
config_data
=
self
.
parse_config
(
file
.
read
())
self
.
display_config
()
except
Exception
as
e
:
messagebox
.
showerror
(
"
Error
"
,
f
"
Failed to read config file:
{
e
}
"
)
def
parse_config
(
self
,
filename
):
result
=
subprocess
.
run
([
"
./parser-cli
"
,
filename
],
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
data
=
{}
lines
=
output
.
splitlines
()
for
line
in
lines
:
match
=
re
.
match
(
r
"
> (\w+)
'
([\w.]+)
'
= (.*)
"
,
line
)
if
match
:
var_type
,
full_name
,
value
=
match
.
groups
()
keys
=
full_name
.
split
(
'
.
'
)
d
=
data
for
key
in
keys
[:
-
1
]:
if
key
not
in
d
:
d
[
key
]
=
{}
d
=
d
[
key
]
d
[
keys
[
-
1
]]
=
value
.
strip
()
return
data
def
parse_config
(
self
,
content
):
data
=
{}
lines
=
content
.
split
(
"
\n
"
)
print
(
lines
)
current_namespace
=
data
namespace_stack
=
[]
for
line
in
lines
:
line
=
line
.
split
(
"
#
"
)[
0
].
strip
()
# Remove comments
if
not
line
:
continue
if
line
.
endswith
(
"
{
"
):
namespace_name
=
line
[:
-
1
].
strip
()
namespace_stack
.
append
(
current_namespace
)
if
namespace_name
not
in
current_namespace
:
current_namespace
[
namespace_name
]
=
{}
current_namespace
=
current_namespace
[
namespace_name
]
elif
line
.
endswith
(
"
}
"
):
current_namespace
=
namespace_stack
.
pop
()
else
:
if
"
=
"
in
line
:
key
,
value
=
[
x
.
strip
()
for
x
in
line
.
split
(
"
=
"
,
1
)]
current_namespace
[
key
]
=
value
.
strip
(
"
;
"
).
strip
()
return
data
def
display_config
(
self
):
for
widget
in
self
.
root
.
winfo_children
():
if
isinstance
(
widget
,
ctk
.
CTkFrame
):
widget
.
destroy
()
self
.
tabview
=
ctk
.
CTkTabview
(
self
.
root
)
self
.
tabview
.
pack
(
expand
=
1
,
fill
=
"
both
"
)
self
.
create_tabs
(
self
.
tabview
,
self
.
config_data
)
def
create_tabs
(
self
,
parent
,
data
,
tab_name
=
"
Main
"
):
tab
=
parent
.
add
(
tab_name
)
row
=
0
for
key
,
value
in
data
.
items
():
if
isinstance
(
value
,
dict
):
sub_tabview
=
ctk
.
CTkTabview
(
tab
)
sub_tabview
.
pack
(
expand
=
1
,
fill
=
"
both
"
,
pady
=
10
)
self
.
create_tabs
(
sub_tabview
,
value
,
key
)
else
:
self
.
create_widget
(
tab
,
key
,
value
,
row
)
row
+=
1
def
create_widget
(
self
,
parent
,
key
,
value
,
row
):
ctk
.
CTkLabel
(
parent
,
text
=
key
).
grid
(
row
=
row
,
column
=
0
,
padx
=
10
,
pady
=
5
)
if
value
.
lower
()
in
(
"
true
"
,
"
false
"
):
var
=
ctk
.
BooleanVar
(
value
=
value
.
lower
()
==
"
true
"
)
ctk
.
CTkSwitch
(
parent
,
variable
=
var
,
text
=
""
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
elif
value
.
replace
(
"
.
"
,
""
,
1
).
isdigit
():
var
=
ctk
.
DoubleVar
(
value
=
value
)
ctk
.
CTkEntry
(
parent
,
textvariable
=
var
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
elif
"
||
"
in
value
:
options
=
[
opt
.
strip
().
strip
(
'"'
)
for
opt
in
value
.
split
(
"
||
"
)]
var
=
ctk
.
StringVar
(
value
=
options
[
0
])
ctk
.
CTkOptionMenu
(
parent
,
variable
=
var
,
values
=
options
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
else
:
var
=
ctk
.
StringVar
(
value
=
value
)
ctk
.
CTkEntry
(
parent
,
textvariable
=
var
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
ctk
.
CTkButton
(
parent
,
text
=
"
...
"
,
command
=
lambda
:
self
.
file_dialog
(
var
)).
grid
(
row
=
row
,
column
=
2
,
padx
=
10
,
pady
=
5
)
def
file_dialog
(
self
,
var
):
file_path
=
filedialog
.
askopenfilename
()
if
file_path
:
var
.
set
(
file_path
)
if
__name__
==
"
__main__
"
:
root
=
ctk
.
CTk
()
app
=
ConfigEditor
(
root
)
root
.
mainloop
()
This diff is collapsed.
Click to expand it.
configeditor2.py
deleted
100644 → 0
+
0
−
96
View file @
b006a327
import
subprocess
import
customtkinter
as
ctk
from
tkinter
import
filedialog
,
messagebox
import
re
ctk
.
set_appearance_mode
(
"
System
"
)
ctk
.
set_default_color_theme
(
"
blue
"
)
class
ConfigEditor
:
def
__init__
(
self
,
root
):
self
.
root
=
root
self
.
root
.
title
(
"
Config File Editor
"
)
self
.
config_data
=
{}
self
.
open_button
=
ctk
.
CTkButton
(
self
.
root
,
text
=
"
Open Config File
"
,
command
=
self
.
open_file
)
self
.
open_button
.
grid
(
column
=
0
,
row
=
0
)
def
open_file
(
self
):
file_path
=
filedialog
.
askopenfilename
(
filetypes
=
[(
"
Config Files
"
,
"
*.txt
"
),
(
"
All Files
"
,
"
*.*
"
)])
if
file_path
:
try
:
self
.
parse_config
(
file_path
)
except
Exception
as
e
:
messagebox
.
showerror
(
"
Error
"
,
f
"
Failed to read config file:
{
e
}
"
)
def
check_tabview
(
self
,
root
):
for
widget
in
root
.
winfo_children
():
if
isinstance
(
widget
,
ctk
.
CTkTabview
):
return
True
,
widget
return
False
,
None
def
parse_config
(
self
,
filename
):
for
widget
in
self
.
root
.
winfo_children
():
if
isinstance
(
widget
,
ctk
.
CTkFrame
):
widget
.
destroy
()
output
=
open
(
filename
,
'
r
'
,
encoding
=
'
utf-8
'
).
read
()
self
.
tabs
=
{}
self
.
rows
=
{}
lines
=
output
.
splitlines
()
for
line
in
lines
:
match
=
re
.
match
(
r
"
> (\w+)
'
([\w.]+)
'
= (.*)
"
,
line
)
if
match
:
var_type
,
full_path
,
value
=
match
.
groups
()
namespaces
=
full_path
.
split
(
'
.
'
)
root
=
self
.
root
for
level
in
range
(
len
(
namespaces
)
-
1
):
path
=
'
.
'
.
join
(
namespaces
[:
level
+
1
])
tabview_exists
,
tabview
=
self
.
check_tabview
(
root
)
if
not
tabview_exists
:
tabview
=
ctk
.
CTkTabview
(
root
,
border_width
=
2
,
border_color
=
"
black
"
)
tabview
.
grid
(
column
=
0
,
row
=
0
,
padx
=
10
,
pady
=
5
)
if
path
not
in
self
.
tabs
:
tab
=
tabview
.
add
(
namespaces
[
level
])
self
.
tabs
[
path
]
=
tab
.
winfo_parent
()
+
'
.
'
+
tab
.
winfo_name
()
self
.
rows
[
path
]
=
1
else
:
self
.
rows
[
path
]
+=
1
print
(
self
.
tabs
)
root
=
self
.
root
.
nametowidget
(
self
.
tabs
[
path
])
self
.
create_widget
(
'
.
'
.
join
(
namespaces
[:
-
1
]),
namespaces
[
-
1
],
value
,
var_type
)
def
create_widget
(
self
,
path
,
key
,
value
,
value_type
):
row
=
self
.
rows
[
path
]
parent
=
self
.
root
.
nametowidget
(
self
.
tabs
[
path
])
ctk
.
CTkLabel
(
parent
,
text
=
key
).
grid
(
row
=
row
,
column
=
0
,
padx
=
10
,
pady
=
5
)
if
value_type
==
'
BOOLEAN
'
:
var
=
ctk
.
BooleanVar
(
value
=
value
.
lower
()
==
"
true
"
)
ctk
.
CTkSwitch
(
parent
,
variable
=
var
,
text
=
""
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
elif
value
.
replace
(
"
.
"
,
""
,
1
).
isdigit
():
var
=
ctk
.
DoubleVar
(
value
=
value
)
ctk
.
CTkEntry
(
parent
,
textvariable
=
var
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
elif
"
dir
"
in
key
.
lower
():
var
=
ctk
.
StringVar
(
value
=
value
)
ctk
.
CTkEntry
(
parent
,
textvariable
=
var
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
ctk
.
CTkButton
(
parent
,
text
=
"
...
"
,
command
=
lambda
:
self
.
file_dialog
(
var
)).
grid
(
row
=
row
,
column
=
2
,
padx
=
10
,
pady
=
5
)
else
:
var
=
ctk
.
StringVar
(
value
=
value
)
ctk
.
CTkEntry
(
parent
,
textvariable
=
var
).
grid
(
row
=
row
,
column
=
1
,
padx
=
10
,
pady
=
5
)
def
file_dialog
(
self
,
var
):
file_path
=
filedialog
.
askopenfilename
()
if
file_path
:
var
.
set
(
file_path
)
if
__name__
==
"
__main__
"
:
root
=
ctk
.
CTk
()
app
=
ConfigEditor
(
root
)
root
.
mainloop
()
This diff is collapsed.
Click to expand it.
ctk.py
deleted
100644 → 0
+
0
−
245
View file @
b006a327
# import customtkinter as ctk
# # Set the appearance and theme of the CustomTkinter
# ctk.set_appearance_mode("System") # Modes: "System" (default), "Dark", "Light"
# ctk.set_default_color_theme("blue") # Themes: "blue" (default), "green", "dark-blue"
# class NestedTabsApp(ctk.CTk):
# def __init__(self):
# super().__init__()
# self.title("Nested Tabs Example")
# self.geometry("600x400")
# # Create the main tab view
# self.main_tabview = ctk.CTkTabview(self, border_width=2, border_color="black")
# self.main_tabview.pack(padx=20, pady=20, fill="both", expand=True)
# # Add tabs to the main tab view
# self.main_tabview.add("Main Tab")
# self.main_tabview.add("Another Tab")
# # Inside "Main Tab", create another tab view for nested tabs
# self.nested_tabview = ctk.CTkTabview(self.main_tabview.tab("Main Tab"), border_width=2, border_color="black")
# self.nested_tabview.pack(padx=20, pady=20, fill="both", expand=True)
# # Add nested tabs to the nested tab view
# self.nested_tabview.add("Nested Tab 1")
# self.nested_tabview.add("Nested Tab 2")
# # Add some content to the nested tabs
# self.label1 = ctk.CTkLabel(self.nested_tabview.tab("Nested Tab 1"), text="Content of Nested Tab 1")
# self.label1.pack(padx=20, pady=20)
# self.label2 = ctk.CTkLabel(self.nested_tabview.tab("Nested Tab 2"), text="Content of Nested Tab 2")
# self.label2.pack(padx=20, pady=20)
# if __name__ == "__main__":
# app = NestedTabsApp()
# app.mainloop()
# import customtkinter as ctk
# # Set appearance mode and color theme
# ctk.set_appearance_mode("System") # Modes: "System", "Dark", "Light"
# ctk.set_default_color_theme("blue") # Themes: "blue", "green", "dark-blue"
# class BorderExampleApp(ctk.CTk):
# def __init__(self):
# super().__init__()
# self.title("Border Example")
# self.geometry("600x400")
# # Create a frame with a border
# frame_with_border = ctk.CTkFrame(self, border_width=2, border_color="black")
# frame_with_border.pack(padx=20, pady=20, fill="both", expand=True)
# # Add a label inside the frame
# label = ctk.CTkLabel(frame_with_border, text="Label with Border")
# label.pack(padx=10, pady=10)
# # Add an entry inside another bordered frame
# entry_frame = ctk.CTkFrame(self, border_width=2, border_color="red")
# entry_frame.pack(padx=20, pady=20, fill="x")
# entry = ctk.CTkEntry(entry_frame)
# entry.pack(padx=10, pady=10)
# # Add a button with a border using a frame
# button_frame = ctk.CTkFrame(self, border_width=2, border_color="blue")
# button_frame.pack(padx=20, pady=20, fill="x")
# button = ctk.CTkButton(button_frame, text="Button with Border")
# button.pack(padx=10, pady=10)
# if __name__ == "__main__":
# app = BorderExampleApp()
# app.mainloop()
import
tkinter
import
tkinter.messagebox
import
customtkinter
customtkinter
.
set_appearance_mode
(
"
System
"
)
# Modes: "System" (standard), "Dark", "Light"
customtkinter
.
set_default_color_theme
(
"
blue
"
)
# Themes: "blue" (standard), "green", "dark-blue"
class
App
(
customtkinter
.
CTk
):
def
__init__
(
self
):
super
().
__init__
()
# configure window
self
.
title
(
"
CustomTkinter complex_example.py
"
)
self
.
geometry
(
f
"
{
1100
}
x
{
580
}
"
)
# configure grid layout (4x4)
self
.
grid_columnconfigure
(
1
,
weight
=
1
)
self
.
grid_columnconfigure
((
2
,
3
),
weight
=
0
)
self
.
grid_rowconfigure
((
0
,
1
,
2
),
weight
=
1
)
# create sidebar frame with widgets
self
.
sidebar_frame
=
customtkinter
.
CTkFrame
(
self
,
width
=
140
,
corner_radius
=
0
)
self
.
sidebar_frame
.
grid
(
row
=
0
,
column
=
0
,
rowspan
=
4
,
sticky
=
"
nsew
"
)
self
.
sidebar_frame
.
grid_rowconfigure
(
4
,
weight
=
1
)
self
.
logo_label
=
customtkinter
.
CTkLabel
(
self
.
sidebar_frame
,
text
=
"
CustomTkinter
"
,
font
=
customtkinter
.
CTkFont
(
size
=
20
,
weight
=
"
bold
"
))
self
.
logo_label
.
grid
(
row
=
0
,
column
=
0
,
padx
=
20
,
pady
=
(
20
,
10
))
self
.
sidebar_button_1
=
customtkinter
.
CTkButton
(
self
.
sidebar_frame
,
command
=
self
.
sidebar_button_event
)
self
.
sidebar_button_1
.
grid
(
row
=
1
,
column
=
0
,
padx
=
20
,
pady
=
10
)
self
.
sidebar_button_2
=
customtkinter
.
CTkButton
(
self
.
sidebar_frame
,
command
=
self
.
sidebar_button_event
)
self
.
sidebar_button_2
.
grid
(
row
=
2
,
column
=
0
,
padx
=
20
,
pady
=
10
)
self
.
sidebar_button_3
=
customtkinter
.
CTkButton
(
self
.
sidebar_frame
,
command
=
self
.
sidebar_button_event
)
self
.
sidebar_button_3
.
grid
(
row
=
3
,
column
=
0
,
padx
=
20
,
pady
=
10
)
self
.
appearance_mode_label
=
customtkinter
.
CTkLabel
(
self
.
sidebar_frame
,
text
=
"
Appearance Mode:
"
,
anchor
=
"
w
"
)
self
.
appearance_mode_label
.
grid
(
row
=
5
,
column
=
0
,
padx
=
20
,
pady
=
(
10
,
0
))
self
.
appearance_mode_optionemenu
=
customtkinter
.
CTkOptionMenu
(
self
.
sidebar_frame
,
values
=
[
"
Light
"
,
"
Dark
"
,
"
System
"
],
command
=
self
.
change_appearance_mode_event
)
self
.
appearance_mode_optionemenu
.
grid
(
row
=
6
,
column
=
0
,
padx
=
20
,
pady
=
(
10
,
10
))
self
.
scaling_label
=
customtkinter
.
CTkLabel
(
self
.
sidebar_frame
,
text
=
"
UI Scaling:
"
,
anchor
=
"
w
"
)
self
.
scaling_label
.
grid
(
row
=
7
,
column
=
0
,
padx
=
20
,
pady
=
(
10
,
0
))
self
.
scaling_optionemenu
=
customtkinter
.
CTkOptionMenu
(
self
.
sidebar_frame
,
values
=
[
"
80%
"
,
"
90%
"
,
"
100%
"
,
"
110%
"
,
"
120%
"
],
command
=
self
.
change_scaling_event
)
self
.
scaling_optionemenu
.
grid
(
row
=
8
,
column
=
0
,
padx
=
20
,
pady
=
(
10
,
20
))
# create main entry and button
self
.
entry
=
customtkinter
.
CTkEntry
(
self
,
placeholder_text
=
"
CTkEntry
"
)
self
.
entry
.
grid
(
row
=
3
,
column
=
1
,
columnspan
=
2
,
padx
=
(
20
,
0
),
pady
=
(
20
,
20
),
sticky
=
"
nsew
"
)
self
.
main_button_1
=
customtkinter
.
CTkButton
(
master
=
self
,
fg_color
=
"
transparent
"
,
border_width
=
2
,
text_color
=
(
"
gray10
"
,
"
#DCE4EE
"
))
self
.
main_button_1
.
grid
(
row
=
3
,
column
=
3
,
padx
=
(
20
,
20
),
pady
=
(
20
,
20
),
sticky
=
"
nsew
"
)
# create textbox
self
.
textbox
=
customtkinter
.
CTkTextbox
(
self
,
width
=
250
)
self
.
textbox
.
grid
(
row
=
0
,
column
=
1
,
padx
=
(
20
,
0
),
pady
=
(
20
,
0
),
sticky
=
"
nsew
"
)
# create tabview
self
.
tabview
=
customtkinter
.
CTkTabview
(
self
,
width
=
250
)
self
.
tabview
.
grid
(
row
=
0
,
column
=
2
,
padx
=
(
20
,
0
),
pady
=
(
20
,
0
),
sticky
=
"
nsew
"
)
self
.
tabview
.
add
(
"
CTkTabview
"
)
self
.
tabview
.
add
(
"
Tab 2
"
)
self
.
tabview
.
add
(
"
Tab 3
"
)
self
.
tabview
.
tab
(
"
CTkTabview
"
).
grid_columnconfigure
(
0
,
weight
=
1
)
# configure grid of individual tabs
self
.
tabview
.
tab
(
"
Tab 2
"
).
grid_columnconfigure
(
0
,
weight
=
1
)
self
.
optionmenu_1
=
customtkinter
.
CTkOptionMenu
(
self
.
tabview
.
tab
(
"
CTkTabview
"
),
dynamic_resizing
=
False
,
values
=
[
"
Value 1
"
,
"
Value 2
"
,
"
Value Long Long Long
"
])
self
.
optionmenu_1
.
grid
(
row
=
0
,
column
=
0
,
padx
=
20
,
pady
=
(
20
,
10
))
self
.
combobox_1
=
customtkinter
.
CTkComboBox
(
self
.
tabview
.
tab
(
"
CTkTabview
"
),
values
=
[
"
Value 1
"
,
"
Value 2
"
,
"
Value Long.....
"
])
self
.
combobox_1
.
grid
(
row
=
1
,
column
=
0
,
padx
=
20
,
pady
=
(
10
,
10
))
self
.
string_input_button
=
customtkinter
.
CTkButton
(
self
.
tabview
.
tab
(
"
CTkTabview
"
),
text
=
"
Open CTkInputDialog
"
,
command
=
self
.
open_input_dialog_event
)
self
.
string_input_button
.
grid
(
row
=
2
,
column
=
0
,
padx
=
20
,
pady
=
(
10
,
10
))
self
.
label_tab_2
=
customtkinter
.
CTkLabel
(
self
.
tabview
.
tab
(
"
Tab 2
"
),
text
=
"
CTkLabel on Tab 2
"
)
self
.
label_tab_2
.
grid
(
row
=
0
,
column
=
0
,
padx
=
20
,
pady
=
20
)
# create radiobutton frame
self
.
radiobutton_frame
=
customtkinter
.
CTkFrame
(
self
)
self
.
radiobutton_frame
.
grid
(
row
=
0
,
column
=
3
,
padx
=
(
20
,
20
),
pady
=
(
20
,
0
),
sticky
=
"
nsew
"
)
self
.
radio_var
=
tkinter
.
IntVar
(
value
=
0
)
self
.
label_radio_group
=
customtkinter
.
CTkLabel
(
master
=
self
.
radiobutton_frame
,
text
=
"
CTkRadioButton Group:
"
)
self
.
label_radio_group
.
grid
(
row
=
0
,
column
=
2
,
columnspan
=
1
,
padx
=
10
,
pady
=
10
,
sticky
=
""
)
self
.
radio_button_1
=
customtkinter
.
CTkRadioButton
(
master
=
self
.
radiobutton_frame
,
variable
=
self
.
radio_var
,
value
=
0
)
self
.
radio_button_1
.
grid
(
row
=
1
,
column
=
2
,
pady
=
10
,
padx
=
20
,
sticky
=
"
n
"
)
self
.
radio_button_2
=
customtkinter
.
CTkRadioButton
(
master
=
self
.
radiobutton_frame
,
variable
=
self
.
radio_var
,
value
=
1
)
self
.
radio_button_2
.
grid
(
row
=
2
,
column
=
2
,
pady
=
10
,
padx
=
20
,
sticky
=
"
n
"
)
self
.
radio_button_3
=
customtkinter
.
CTkRadioButton
(
master
=
self
.
radiobutton_frame
,
variable
=
self
.
radio_var
,
value
=
2
)
self
.
radio_button_3
.
grid
(
row
=
3
,
column
=
2
,
pady
=
10
,
padx
=
20
,
sticky
=
"
n
"
)
# create slider and progressbar frame
self
.
slider_progressbar_frame
=
customtkinter
.
CTkFrame
(
self
,
fg_color
=
"
transparent
"
)
self
.
slider_progressbar_frame
.
grid
(
row
=
1
,
column
=
1
,
padx
=
(
20
,
0
),
pady
=
(
20
,
0
),
sticky
=
"
nsew
"
)
self
.
slider_progressbar_frame
.
grid_columnconfigure
(
0
,
weight
=
1
)
self
.
slider_progressbar_frame
.
grid_rowconfigure
(
4
,
weight
=
1
)
self
.
seg_button_1
=
customtkinter
.
CTkSegmentedButton
(
self
.
slider_progressbar_frame
)
self
.
seg_button_1
.
grid
(
row
=
0
,
column
=
0
,
padx
=
(
20
,
10
),
pady
=
(
10
,
10
),
sticky
=
"
ew
"
)
self
.
progressbar_1
=
customtkinter
.
CTkProgressBar
(
self
.
slider_progressbar_frame
)
self
.
progressbar_1
.
grid
(
row
=
1
,
column
=
0
,
padx
=
(
20
,
10
),
pady
=
(
10
,
10
),
sticky
=
"
ew
"
)
self
.
progressbar_2
=
customtkinter
.
CTkProgressBar
(
self
.
slider_progressbar_frame
)
self
.
progressbar_2
.
grid
(
row
=
2
,
column
=
0
,
padx
=
(
20
,
10
),
pady
=
(
10
,
10
),
sticky
=
"
ew
"
)
self
.
slider_1
=
customtkinter
.
CTkSlider
(
self
.
slider_progressbar_frame
,
from_
=
0
,
to
=
1
,
number_of_steps
=
4
)
self
.
slider_1
.
grid
(
row
=
3
,
column
=
0
,
padx
=
(
20
,
10
),
pady
=
(
10
,
10
),
sticky
=
"
ew
"
)
self
.
slider_2
=
customtkinter
.
CTkSlider
(
self
.
slider_progressbar_frame
,
orientation
=
"
vertical
"
)
self
.
slider_2
.
grid
(
row
=
0
,
column
=
1
,
rowspan
=
5
,
padx
=
(
10
,
10
),
pady
=
(
10
,
10
),
sticky
=
"
ns
"
)
self
.
progressbar_3
=
customtkinter
.
CTkProgressBar
(
self
.
slider_progressbar_frame
,
orientation
=
"
vertical
"
)
self
.
progressbar_3
.
grid
(
row
=
0
,
column
=
2
,
rowspan
=
5
,
padx
=
(
10
,
20
),
pady
=
(
10
,
10
),
sticky
=
"
ns
"
)
# create scrollable frame
self
.
scrollable_frame
=
customtkinter
.
CTkScrollableFrame
(
self
,
label_text
=
"
CTkScrollableFrame
"
)
self
.
scrollable_frame
.
grid
(
row
=
1
,
column
=
2
,
padx
=
(
20
,
0
),
pady
=
(
20
,
0
),
sticky
=
"
nsew
"
)
self
.
scrollable_frame
.
grid_columnconfigure
(
0
,
weight
=
1
)
self
.
scrollable_frame_switches
=
[]
for
i
in
range
(
100
):
switch
=
customtkinter
.
CTkSwitch
(
master
=
self
.
scrollable_frame
,
text
=
f
"
CTkSwitch
{
i
}
"
)
switch
.
grid
(
row
=
i
,
column
=
0
,
padx
=
10
,
pady
=
(
0
,
20
))
self
.
scrollable_frame_switches
.
append
(
switch
)
# create checkbox and switch frame
self
.
checkbox_slider_frame
=
customtkinter
.
CTkFrame
(
self
)
self
.
checkbox_slider_frame
.
grid
(
row
=
1
,
column
=
3
,
padx
=
(
20
,
20
),
pady
=
(
20
,
0
),
sticky
=
"
nsew
"
)
self
.
checkbox_1
=
customtkinter
.
CTkCheckBox
(
master
=
self
.
checkbox_slider_frame
)
self
.
checkbox_1
.
grid
(
row
=
1
,
column
=
0
,
pady
=
(
20
,
0
),
padx
=
20
,
sticky
=
"
n
"
)
self
.
checkbox_2
=
customtkinter
.
CTkCheckBox
(
master
=
self
.
checkbox_slider_frame
)
self
.
checkbox_2
.
grid
(
row
=
2
,
column
=
0
,
pady
=
(
20
,
0
),
padx
=
20
,
sticky
=
"
n
"
)
self
.
checkbox_3
=
customtkinter
.
CTkCheckBox
(
master
=
self
.
checkbox_slider_frame
)
self
.
checkbox_3
.
grid
(
row
=
3
,
column
=
0
,
pady
=
20
,
padx
=
20
,
sticky
=
"
n
"
)
# set default values
self
.
sidebar_button_3
.
configure
(
state
=
"
disabled
"
,
text
=
"
Disabled CTkButton
"
)
self
.
checkbox_3
.
configure
(
state
=
"
disabled
"
)
self
.
checkbox_1
.
select
()
self
.
scrollable_frame_switches
[
0
].
select
()
self
.
scrollable_frame_switches
[
4
].
select
()
self
.
radio_button_3
.
configure
(
state
=
"
disabled
"
)
self
.
appearance_mode_optionemenu
.
set
(
"
Dark
"
)
self
.
scaling_optionemenu
.
set
(
"
100%
"
)
self
.
optionmenu_1
.
set
(
"
CTkOptionmenu
"
)
self
.
combobox_1
.
set
(
"
CTkComboBox
"
)
self
.
slider_1
.
configure
(
command
=
self
.
progressbar_2
.
set
)
self
.
slider_2
.
configure
(
command
=
self
.
progressbar_3
.
set
)
self
.
progressbar_1
.
configure
(
mode
=
"
indeterminnate
"
)
self
.
progressbar_1
.
start
()
self
.
textbox
.
insert
(
"
0.0
"
,
"
CTkTextbox
\n\n
"
+
"
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
\n\n
"
*
20
)
self
.
seg_button_1
.
configure
(
values
=
[
"
CTkSegmentedButton
"
,
"
Value 2
"
,
"
Value 3
"
])
self
.
seg_button_1
.
set
(
"
Value 2
"
)
def
open_input_dialog_event
(
self
):
dialog
=
customtkinter
.
CTkInputDialog
(
text
=
"
Type in a number:
"
,
title
=
"
CTkInputDialog
"
)
print
(
"
CTkInputDialog:
"
,
dialog
.
get_input
())
def
change_appearance_mode_event
(
self
,
new_appearance_mode
:
str
):
customtkinter
.
set_appearance_mode
(
new_appearance_mode
)
def
change_scaling_event
(
self
,
new_scaling
:
str
):
new_scaling_float
=
int
(
new_scaling
.
replace
(
"
%
"
,
""
))
/
100
customtkinter
.
set_widget_scaling
(
new_scaling_float
)
def
sidebar_button_event
(
self
):
print
(
"
sidebar_button click
"
)
if
__name__
==
"
__main__
"
:
app
=
App
()
app
.
mainloop
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment