2021年3月19日金曜日

PySimpleGUIで複数行入力フィールド要素のパディングを指定する

PySimpleGUIで複数行入力フィールド要素のパディングを指定するには、padパラメータを指定します。

サンプル実行手順

以下のファイルを保存して、実行します。
multiline_pad.py
import PySimpleGUI as sg

sg.theme('SystemDefault')
left=32
right=16
top=8
bottom=4
layout = [[sg.Multiline(default_text="サンプル\nデータ", pad=((left,right),(top,bottom)), size=(10,3)) ]]

window = sg.Window('サンプル', layout)
# イベントループ
while True:
    event, values = window.read()
    if event == sg.WIN_CLOSED:
        break

window.close()

実行コマンド
python multiline_pad.py

〇実行結果

関連情報

PySimpleGUIで複数行入力フィールド要素のフォント・フォントサイズを指定する

PySimpleGUIで複数行入力フィールド要素の文字色・背景色を指定する

PySimpleGUIで複数行入力フィールド要素の幅・高さを指定する

・PySimpleGUIに関する他の記事はこちらを参照してください。

0 件のコメント:

コメントを投稿