Код: Выделить всё
from tkinter import *
root = Tk()
C = Canvas(root, bg="yellow",height=250, width=300)
line = C.create_line(108, 120,320, 40,fill="green")
arc = C.create_arc(180, 150, 80, 210, start=0,extent=220,fill="red")
oval = C.create_oval(80, 30, 140,150, fill="blue")
C.pack()
mainloop()
Код: Выделить всё
-> python tkTest2.py
Код: Выделить всё
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
Код: Выделить всё
2024-11-26 15:16:47.379 python[29220:77343080] +[IMKClient subclass]: chose IMKClient_Modern
2024-11-26 15:16:47.379 python[29220:77343080] +[IMKInputSession subclass]: chose IMKInputSession_Modern
Код: Выделить всё
-> brew install tcl-tk
==> Caveats
==> tcl-tk
The sqlite3_analyzer binary is in the `sqlite-analyzer` formula.
-> brew install python-tk@3.10
==> Caveats
==> python-tk@3.10
python-tk@3.10 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
-> brew install pyenv
-> pyenv install 3.10.15 master
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.15.tar.xz...
-> https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tar.xz
Installing Python-3.10.15...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.10.15 to /Users/johnkomp/.pyenv/versions/3.10.15
-> pyenv versions master
system
* 3.10.15 (set by /Users/johnkomp/Programming/git/Stochastic-Games/RL-Apps/.python-version)
-> pyenv local 3.10.15 master
-> pyenv global 3.10.15
Мой PATH:
Код: Выделить всё
/opt/homebrew/Cellar/tcl-tk/9.0.0_1/bin:/usr/local/bin:/usr/local/bin:/Users/mike/.local/bin:/Users/mikesmith/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin
Код: Выделить всё
import tkinter
root = tkinter.Tk()
print(root.tk.exprstring('$tcl_library'))
print(root.tk.exprstring('$tk_library'))
print(tkinter.TkVersion)
Код: Выделить всё
-> python tkTest.py
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts
/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts
8.5
/Users/mikesmith/.pyenv/versions/3.10.15/bin/python
Код: Выделить всё
-> which python
/Users/mikesmith/.pyenv/shims/python
Подробнее здесь: https://stackoverflow.com/questions/792 ... ank-screen
Мобильная версия