Python用モジュール「Tkinter」でステータスバーの文字を設定する方法についてソースコード付きでまとめました。
Tkinterでステータスバーの文字設定
Pythonの標準モジュール「Tkinter」を用いて、ステータスバーの文字を設定し表示します。
サンプルコード(Python3)
サンプルプログラムのソースコードです。
# -*- coding:utf-8 -*-
import sys
import tkinter
root = tkinter.Tk()
root.title("タイトル")
root.geometry("300x300")
# ステータスバーの設定
status = tkinter.Label(root, text="にゃんぱすー", borderwidth=2, relief="groove")
status.pack(side=tkinter.BOTTOM, fill=tkinter.X)
root.mainloop()
「text=」にテキストに表示したい文字列を入れます。
| – | 関連記事 |
|---|---|
| 1 | ■【Python/Tkinter】GUIアプリ作成入門 ■【Python】GUIライブラリの比較・おすすめ |
| 2 | ■Python入門 基本文法 |

コメント