python:desktop_app
差分
このページの2つのバージョン間の差分を表示します。
python:desktop_app [2025/01/01 12:38] – 作成 mikoto | python:desktop_app [2025/01/01 12:57] (現在) – mikoto | ||
---|---|---|---|
行 1: | 行 1: | ||
====== Tkinterを使ったデスクトップアプリの作成 ====== | ====== Tkinterを使ったデスクトップアプリの作成 ====== | ||
+ | |||
+ | ===== 基本パーツ ===== | ||
+ | メインのウィンドウとラベル、1行のテキストエリア、ボタン等のテンプレート | ||
+ | <code python> | ||
+ | import tkinter as tk | ||
+ | |||
+ | root = tk.Tk() # メインウィンドウ作成 | ||
+ | root.title(" | ||
+ | |||
+ | |||
+ | # テキストエリアの作成 | ||
+ | text_area_label = tk.Label(root, | ||
+ | text_area_label.grid(row=0, | ||
+ | text_area = tk.Text(root, | ||
+ | text_area.grid(row=1, | ||
+ | |||
+ | def button_executed(): | ||
+ | print(" | ||
+ | button = tk.Button(root, | ||
+ | button.grid(row=0, | ||
+ | |||
+ | # メインループ | ||
+ | root.mainloop() | ||
+ | </ | ||
===== コンテキストメニューを追加する ===== | ===== コンテキストメニューを追加する ===== |
python/desktop_app.1735702688.txt.gz · 最終更新: 2025/01/01 12:38 by mikoto