ユーザ用ツール

サイト用ツール


python:desktop_app

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

python:desktop_app [2025/01/01 12:38] – 作成 mikotopython: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="aaa")
 +text_area_label.grid(row=0, column=0, sticky=tk.W)
 +text_area = tk.Text(root, height=10)
 +text_area.grid(row=1,column=0, columnspan=2, sticky=tk.W)
 +
 +def button_executed():
 +    print("Executed")
 +button = tk.Button(root, text="実行", width=10, command=button_executed)
 +button.grid(row=0,column=1,sticky=tk.W)
 +
 +# メインループ
 +root.mainloop()
 +</code>
  
 ===== コンテキストメニューを追加する ===== ===== コンテキストメニューを追加する =====
python/desktop_app.1735702688.txt.gz · 最終更新: 2025/01/01 12:38 by mikoto