Convert your tkinter scripts and guis to custom tkinter with this command line tool. Can determine programming paradigm and import structure to keep consistency across files
please, please, please if you experience a bug or bad operations please submit them to me so i can fix it immediatly. i dont have hundreds of guis to test this on.
tk2ctk - Tkinter to CustomTkinter
Description: tkinter to customtkinter file converter.
Usage: tk2ctk [file] [Options]
tk2ctk -m [file] [file2] [file3] ...
tk2ctk [file] -o [file]
Options:
-h, --help Show this help message and exit
-o, --output Define the output file
-v, --verbose Operate with higher verbosity level
-l, --listboxes Convert listboxes to custom listboxes
-m, --multiple Convert multiple target scripts
-e, --examples Show examples for flags and options
-o Flag is used to set the outfile
-l flag converts tk.Listbox to a custom version
-m is the multiple targets flag. Use this to target more then one tkinter script
-e shows example usages
The SourceConverter class is a standalone class that can convert source to source. That is that it can convert tkinter python source strings to customtkinter source strings.
Case #1 from a string
from .converter import SourceConverter
sc = SourceConverter()
with open("myfile.py", "r) as f:
content = f.read()
ctk_source = sc.from_string(content)
or
import .converter
sc = converter.SourceConverter()
with open("myfile.py", "r) as f:
content = f.read()
ctk_source = sc.from_string(content)
Case #2 from a file
from .converter import SourceConverter
sc = SourceConverter()
ctk_source = sc.from_file(content)
or
import .converter
sc = converter.SourceConverter()
ctk_source = sc.from_file(content)
Thank you Tom Schimansky for this wonderful and beautiful tkinter addition! I am not associated with customtkinter in any way.
Please see https://github.com/TomSchimansky/CustomTkinter
git clone https://github.com/Donny-GUI/tkinter-to-customtkinter-converter.git
cd tkinter-to-customtkinter-converter
python tk_to_ctk.py <target>
git clone https://github.com/Donny-GUI/tkinter-to-customtkinter-converter.git
cd tkinter-to-customtkinter-converter
python3 tk_to_ctk.py <target>
Contains utility functions and constants
get_operating_system()
# get the name of the operating system
pip_str
# Literal string for using pip aka pip or pip3
Contains the WidgetReplacer class