參考資訊:
https://tkdocs.com/shipman/
https://www.pythontutorial.net/tkinter/tkinter-window/
main.py
import tkinter as tk root = tk.Tk() root.title('main') root.geometry('300x300') canvas = tk.Canvas(root, width = 300, height = 300, bg = 'black') canvas.grid() canvas.create_text(100, 100, fill = 'red', text = 'test', font = ('Monospace', 14, 'bold')) root.mainloop()
執行
$ python3 main.py