PySimpleGUI / PySimpleGUI/PySimpleGUI

[ Enhancement/Bug] We can't set the color of pad.

Open
#2,717 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Type of Issues (Enhancement, Error, Bug, Question)

Enhancement/bug

Operating System

Windows10

Python version

3.8.2

PySimpleGUI Port and Version

version: 4.16.0 Released 20 Feb 2020
port:PySimpleGUI
This is critical to know. Knowing where your PySimpleGUI.py file is located is just as important. You can get these by adding this to the top of your file and running it:

import PySimpleGUI as sg
print(sg)
print(sg.version)
Your Experience Levels In Months or Years

4 months Python programming experience
21 months Programming experience overall
No Have used another Python GUI Framework (tkiner, Qt, etc) previously (yes/no is fine)?

You have completed these steps:
  • Read instructions on how to file an Issue
  • Searched through main docs http://www.PySimpleGUI.org for your problem
  • Searched through the readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Looked for Demo Programs that are similar to your goal http://www.PySimpleGUI.com
  • Note that there are also Demo Programs under each port on GitHub
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported
Description of Problem / Question / Details

When using the function Extend() to add a new element, the color of the pad can't be changed and will be kept in the defaultcolor. But if the background color is different from the default, it will look stange.

You can see this by using the following program.

Code To Duplicate
import PySimpleGUI as sg

chat_layout=[
    [sg.Button("Add",key="add",font=("Consolas",20,"bold"),size=(13,1),button_color=("#FFF7FF","#729FCF"),pad=((1,0),0))]
]

chat_window=sg.Window("Chat Room",chat_layout,size=(950,500),border_depth=0,margins=(0,0),background_color="#300A24",alpha_channel=.9)

while 1:
    event,value=chat_window.read(timeout=100,timeout_key="TimeOut")
    if event=="add":
        chat_window.extend_layout(chat_window,
            [[sg.Button("123",font=("Consolas",13,"bold"),button_color=("#FFF7FF","#729FCF"),size=(20,1),pad=(5,5)),]])

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied Python reproduction on Windows with PySimpleGUI 4.16.0, then trace the Window.extend_layout entry point and how the appended Button handles pad and color settings. Done means the dynamically added button uses its requested colors and padding rather than the default color against the custom window background.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.