4737

 更新日:

Python tkinter GUI サンプルプログラム集
目  次

第 1 章 メインウィンドウ(MainWindow)
1. 1 メインウィンドウの作成
1. 2 オプションパラメータ
1. 3 オプションの設定と取得(configure、config、cget)
1.3.1 キーワードインデックス
1.3.2 configure、config メソッド
1.3.3 cget メソッド
1. 4 サイズ(width、height)
1. 5 背景色(background、bg)
1. 6 境界枠と形状(borderwidth、bd、relief)
1. 7 パッディング(padx、pady)
1. 8 ハイライト(highlightthickness、highlightcolor、highlightbackground)
1. 9 マウスカーソル(cursor)
1.10 スクリーン表示位置とサイズ(1)(wm_geometry、geometry、update)
1.11 スクリーン表示位置とサイズ(2)(winfo_x、winfo_y、winfo_rootx、winfo_rooty、winfo_width、winfo_height、winfo_reqwidth、winfo_reqheight)
1.12 スクリーン中央への配置(1)(winfo_screenwidth、winfo_screenheight)
1.13 スクリーン中央への配置(2)(eval、tk.call、tk::PlaceWindow)
1.14 ウィンドウサイズの制限(wm_minsize、minsize、wm_maxsize、maxsize)
1.15 ウィンドウサイズの固定(wm_resizable、resizable)
1.16 グリッドウィンドウ(wm_grid、grid)
1.17 ウィンドウタイトル(wm_title、title)
1.18 タイトルバーの非表示(wm_overrideredirect、overrideredirect)
1.19 クローズボタンの無効化とウィンドウのクローズ(wm_protocol、protocol、destroy、quit)
1.20 表示状態の制御(wm_state、state、wm_withdraw、withdrawn、wm_iconify、iconify、wm_deiconify、deiconify)
1.21 ウィンドウアイコン(wm_iconbitmap、iconbitmap、wm_iconphoto、iconphoto)
1.22 メニューバー(menu、tkinter.Menu、tkinter.Menu.add_command、tkinter.Menu.add_cascade)
1.23 システムメニュー(menu、tkinter.Menu、tkinter.Menu.add_command、tkinter.Menu.add_cascade)
1.24 Windows 固有の属性(アトリビュート)(wm_attributes、attributes)
1.24.1 ウィンドウの無効化(-disabled)
1.24.2 ウィンドウの最前面表示(-topmost)
1.24.3 クライアント領域の拡大表示(-fullscreen)
1.24.4 ツールウインドウ(-toolwindow)
1.24.5 透明度(-alpha)
1.24.6 透過色(-transparentcolor)
1.25 前面、背面表示(lift、tkraise、lower)
1.26 スケジュール(タイマー)処理(after、after_idle、after_cancel)
1.27 複数のメインウィンドウ(mainloop、mainloop(n)、focus_force)
1.28 イベント処理(bind、unbind)
1.29 ウィンドウハンドルの取得(wm_frame)
1.30 デフォルトカラーの変更(tk_setPalette)

第 2 章 サブウィンドウ(Toplevel)
2.1 サブウィンドウの作成
2. 2 オプションパラメータ
2. 3 オプションの設定と取得(configure、config、cget)
2.3.1 引数
2.3.2 キーワードインデックス
2.3.3 configure、config メソッド
2.3.4 cget メソッド
2. 4 サイズ(width、height)
2. 5 背景色(background、bg)
2. 6 境界枠と形状(borderwidth、bd、relief)
2. 7 パッディング(padx、pady)
2. 8 ハイライト(highlightthickness、highlightcolor、highlightbackground)
2. 9 マウスカーソル(cursor)
2.10 スクリーン表示位置とサイズ(1)(wm_geometry、geometry、update)
2.11 スクリーン表示位置とサイズ(2)(winfo_x、winfo_y、winfo_rootx、winfo_rooty、winfo_width、winfo_height、winfo_reqwidth、winfo_reqheight)
2.12 スクリーン中央への配置(1)(winfo_screenwidth、winfo_screenheight)
2.13 スクリーン中央への配置(2)(eval、tk.call、tk::PlaceWindow)
2.14 ウィンドウサイズの制限(wm_minsize、minsize、wm_maxsize、maxsize)
2.15 ウィンドウサイズの固定(wm_resizable、resizable)
2.16 グリッドウィンドウ(wm_grid、grid)
2.17 ウィンドウタイトル(wm_title、title)
2.18 タイトルバーの非表示(wm_overrideredirect、overrideredirect)
2.19 クローズボタンの無効化とウィンドウのクローズ(wm_protocol、protocol、destroy、quit)
2.20 表示状態の制御(wm_state、state、wm_withdraw、withdrawn、wm_iconify、iconify、wm_deiconify、deiconify)
2.21 ウィンドウアイコン(wm_iconbitmap、iconbitmap、wm_iconphoto、iconphoto)
2.22 メニューバー(menu、tkinter.Menu、tkinter.Menu.add_command、tkinter.Menu.add_cascade)
2.23 システムメニュー(menu、tkinter.Menu、tkinter.Menu.add_command、tkinter.Menu.add_cascade)
2.24 Windows 固有の属性(アトリビュート)(wm_attributes、attributes)
2.24.1 ウィンドウの無効化(-disabled)
2.24.2 ウィンドウの最前面表示(-topmost)
2.24.3 クライアント領域の拡大表示(-fullscreen)
2.24.4 ツールウインドウ(-toolwindow)
2.24.5 透明度(-alpha)
2.24.6 透過色(-transparentcolor)
2.25 前面、背面表示(lift、tkraise、lower、focus_force)
2.26 スケジュール(タイマー)処理(after、after_idle、after_cancel)
2.27 複数のサブウィンドウ(wm_deiconify、deiconify、lift、tkraise、focus_force)
2.28 イベント処理(bind、unbind)
2.29 ウィンドウハンドルの取得(wm_frame)
2.30 ウィンドウの切り替え表示(container、use、winfo_id)
2.31 モーダルウィンドウの設定(grab_set、focus_set)
2.32 オブジェクト名の設定と名前、パス名の取得(name、winfo_name、winfo_id、winfo_pathname)
2.33 クラス名とイベント処理(class、bind_class、winfo_class)
2.34 デフォルトカラーの変更(tk_setPalette)

第 3 章 フレーム(Frame)
3.1 フレームの作成
3. 2 オプションパラメータ
3. 3 オプションの設定と取得(configure、config、cget)
3. 4 サイズ(width、height)
3. 5 背景色(background、bg)
3. 6 境界枠と形状(borderwidth、bd、relief)
3. 7 パッディング(padx、pady)
3. 8 フォーカスとハイライト(takefocus、highlightthickness、highlightcolor、highlightbackground)
3. 9 マウスカーソル(cursor)
3.10 フレーム表示位置とサイズ(1)(place_configure、place、x、y、width、height、place_info)
3.11 フレーム表示位置とサイズ(2)(winfo_x、winfo_y、winfo_rootx、winfo_rooty、winfo_width、winfo_height、winfo_reqwidth、winfo_reqheight、update)
3.12 フレーム表示位置とサイズ(3)(place_configure、place、relx、rely、relwidth、relheight)
3.13 アンカーによるフレーム表示位置(place_configure、place、anchor)
3.14 フレームの削除、非表示(destroy、place_forget)
3.15 透明度、透過色(container、use、winfo_id、wm_attributes、attributes)
3.16 前面、背面表示(lift、tkraise、lower)
3.17 スケジュール(タイマー)処理(after、after_idle、after_cancel)
3.18 イベント処理(bind、unbind、focus_set)
3.19 ウィンドウハンドルの取得(winfo_id)
3.20 オブジェクト名の設定と名前、パス名の取得(name、winfo_name、winfo_id、winfo_pathname)
3.21 クラス名とイベント処理(class、bind_class、winfo_class)
3.22 デフォルトカラーの変更(tk_setPalette)

第 4 章 ラベルフレーム(Frame)
4.1 ラベルフレームの作成
4. 2 オプションパラメータ
4. 3 オプションの設定と取得(configure、config、cget)
4. 4 サイズ(width、height)
4. 5 背景色(background、bg)
4. 6 境界枠と形状(borderwidth、bd、relief)
4. 7 パッディング(padx、pady)
4. 8 フォーカスとハイライト(takefocus、highlightthickness、highlightcolor、highlightbackground)
4. 9 マウスカーソル(cursor)
4.10 テキストと配置(text、labelanchor)
4.11 フォントと色(font、fg、foreground)
4.12 ラベルの置き換え(labelwidget)
4.13 ラベルフレーム表示位置とサイズ(1)(place_configure、place、x、y、width、height、place_info)
4.14 ラベルフレーム表示位置とサイズ(2)(winfo_x、winfo_y、winfo_rootx、winfo_rooty、winfo_width、winfo_height、winfo_reqwidth、winfo_reqheight、update)
4.15 ラベルフレーム表示位置とサイズ(3)(place_configure、place、relx、rely、relwidth、relheight)
4.16 アンカーによるラベルフレーム表示位置(place_configure、place、anchor)
4.17 ラベルフレームの削除、非表示(destroy、place_forget)
4.18 透明度、透過色(container、use、winfo_id、wm_attributes、attributes)
4.19 前面、背面表示(lift、tkraise、lower)
4.20 スケジュール(タイマー)処理(after、after_idle、after_cancel)
4.21 イベント処理(bind、unbind、focus_set)
4.22 ウィンドウハンドルの取得(winfo_id)
4.23 オブジェクト名の設定と名前、パス名の取得(name、winfo_name、winfo_id、winfo_pathname)
4.24 クラス名とイベント処理(class、bind_class、winfo_class)
4.25 デフォルトカラーの変更(tk_setPalette)

A 付属資料

A1 共通属性
A1.1 位置、サイズ単位
A1.2 座標系
A1.3 色
A1.4 フォント
A1.5 アンカー
A1.6 レリーフスタイル
A1.7 登録ビットマップ
A1.8 登録マウスカーソル
A1.9 イメージ
A1.10 geometry 文字列
A1.11 ウィンドウ名、ウィンドウパス名
A1.12 線描画の Cap と Join スタイル
A1.13 線描画のダッシュパターン

A2 Wmクラスメソッド

A3 Miscクラスメソッド