Practical implementation of few of the interesting games that can be played after compiling the standalone source code files.
Steps to install Python interface to Tcl-Tk GUI toolkit on Mac OS (Apple Silicon).
brew install tcl-tk
brew install pyenv
NOTE: 8.6.15 is the version of installed tcl-tk toolkit.
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
eval "$(pyenv init --path)"
export PATH="/opt/homebrew/Cellar/tcl-tk/8.6.15/bin/:$PATH"
LDFLAGS="-L/opt/homebrew/Cellar/tcl-tk/8.6.15/lib"
CPPFLAGS="-I/opt/homebrew/Cellar/tcl-tk/8.6.15/include"
PKG_CONFIG_PATH="/opt/homebrew/Cellar/tcl-tk/8.6.15/lib/pkgconfig"
source <absolute_path>/.bash_profile
PYTHON_CONFIGURE_OPTS="--enable-framework --with-tcltk-includes='-I/opt/homebrew/Cellar/tcl-tk/8.6.15/include' --with-tcltk-libs='-L/opt/homebrew/Cellar/tcl-tk/8.6.15/lib -ltcl8.6.15 -ltk8.6.15'" pyenv install <python_version>
pyenv global <python_version>
brew install python-tk
python -m pip install tk
Use the following command to test if tkinter has been installed correctly and Python is configured to work with tcl-tk toolkit
NOTE: If the installation was successful, the command will open a new GUI window with 'tk' as the title and display the tck-tk version.
python -m tkinter -c "tkinter._test()"
Please note that the code and technical details made available are for anyone interested to learn. The repo is not open for collaboration.
If you happen to use the code from this repo, please cite my user name along with link to my profile: https://github.com/balarcode. Thank you!