简体   繁体   English

使用 PySimpleGUI 的零边距布局

[英]Zero Margin Layout with PySimpleGUI

I am trying to make a layout with zero top, left and right margin in Python with PySimpleGui.我正在尝试使用 PySimpleGui 在 Python 中制作一个顶部、左侧和右侧边距为零的布局。

Example code示例代码

import PySimpleGUI as sg

layout = [[sg.Text('Text with background color', background_color='#FF0000')]]
window = sg.Window('Title', layout, size=(200, 200))

Code result编码结果

在此处输入图片说明

Question

Any ideas on how to remove the left, right, and the top margin?关于如何删除左边距、右边距和上边距的任何想法? So the text would be aligned to coordinates x=0, y=0 without the blue margin?那么文本将与坐标 x=0, y=0 对齐而没有蓝色边距?

Could it be solved with some kind of offset or just a default-margin parameter?是否可以通过某种偏移量或仅使用默认边距参数来解决?

  • Text → no padding: pad=(0,0)文字 → 无填充: pad=(0,0)
  • Window → no margin: margins=(0,0)窗口 → margins=(0,0)margins=(0,0)
layout = [[sg.Text('Text with background color', background_color='#FF0000', pad=(0,0))]]
window = sg.Window('Title', layout, size=(200, 200), margins=(0,0))

Zero margin layout零边距布局

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM