*disclaimer
1196915
Tkinter
import tkinter as tk
メソッド
.Label() ラベルの作成
- 表示する文字 text="Fraction"
self.label = tk.Label(root, text="Fraction", font=("MS Gothic", 68))
.Button() ボタンの作成
- ボタンに表示する文字 text="Start"
- ボタンを押したらstep1を実行 command=self.step1
self.button = tk.Button(root, text="Start", font=("MS Gothic", 24), command=self.step1)
.pack() ウィジェットの配置
- 上から下へ順番に配置
- オプション
- side="left" などで上下左右の配置
- padx=10 でx軸(つまり左右)に10の余白設定
- pady=20 でy軸(つまり上下)に20の余白の設定
self.label = tk.Label(root, text="Fraction", font=("MS Gothic", 68))
self.label.pack(pady=50)
.grid()
.place()
.Label() ラベルの作成
- 表示する文字 text="Start"
self.button = tk.Button(root, text="Start", font=("MS Gothic", 24), command=self.step1)
self.button.pack(pady=20)
.Button() ボタンの作成
- ボタンに表示する文字 text="Start"
- ボタンを押したらstep1を実行 command=self.step1
self.button = tk.Button(root, text="Start", font=("MS Gothic", 24), command=self.step1)
self.button.pack(pady=20)
サンプル
fraction.py(91)
fraction.exe(94)
https://sugiura-ken.org/wiki/