Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Bug] Custom Titlebar window focus problems

Abierto
#6,783 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
desktop

Línea de trabajo

Comience ejecutando la reproducción de Python proporcionada en Linux y compare el comportamiento con y sin use_custom_titlebar. Rastree el manejo del foco de la ventana de la barra de título personalizada utilizado por el punto de entrada Window y, a continuación, verifique que mover el puntero sobre la ventana principal no le dé el foco mientras la ventana secundaria se superpone a ella. Vuelva a ejecutar el ejemplo proporcionado para confirmar el comportamiento de foco esperado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug Platform Specific Issue - Linux Port - TK

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

Bug


Environment

Operating System

Linux version ('glibc', '2.35')

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python version (sg.sys.version)

3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]

PySimpleGUI Version (sg.__version__)

5.0.4.15

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

8.6.12


Your Experience In Months or Years (optional)

Years Python programming experience
Years Programming experience overall
No Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • Searched main docs for your problem https://Docs.PySimpleGUI.com
  • Looked for Demo Programs that are similar to your goal.
    It is recommend you use the Demo Browser! https://Demos.PySimpleGUI.com
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • None of your GUI code was generated by an AI algorithm like GPT
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported https://Issues.PySimpleGUI.com
  • Have upgraded to the latest release of PySimpleGUI on PyPI (latest official version) https://Upgrading.PySimpleGUI.com
  • Tried running the Maintenance Release. Use Home Window to access Maint Releases
  • For licensing questions please email mailto:license@PySimpleGUI.com

Detailed Description

When multiple windows are open and overlapping, moving the mouse to the parent window sends child to the back. I have 2 windows, the first has a button to call the second window. If the second window overlaps the parent window in any way, moving the mouse into the parent window immediately gives focus to that, hiding the overlapping portion of window 2. It should require a mouse click in the parent window before giving it focus.
If I comment out the 'use custom titlebar' option it works correctly but I then have borders around the window, so things like the button bar, status bar are indented on both sides, looking pretty ordinary. I have tried defining the titlebar separately & not setting the option within the window call but the result is the same.

Code To Duplicate
import PySimpleGUI as sg

def main_window():
    winsize = (800, 600)
    toolbar_buttons = [[sg.Button('Test', key='-TEST-')]]
    layout = [[sg.Frame('', toolbar_buttons, title_color='white', size=(winsize[0], 30),
                        pad=(0,0), background_color=sg.COLOR_SYSTEM_DEFAULT)]]
    win1 = sg.Window('test', size=winsize,
                     use_custom_titlebar=True,
                     layout=layout)

    while True:
        event, values = win1.read()
        print('main event= ', event)
        if event == '-TEST-':
            second_window()
        if event in (sg.WIN_CLOSED, '-CANCEL', 'CANCELB', '-EXIT-'):
            break
    win1.close()


def second_window():
    winsize = (600, 400)
    layout = [[sg.Text('Input',pad=(5, 0))],
              [sg.Input()]
              ]
    win2 = sg.Window('test', layout=layout, size=winsize,
                     keep_on_top=True, use_custom_titlebar=True)
    while True:
        event, values = win2.read()
        if event in (sg.WIN_CLOSED, '-CANCEL', 'CANCELB', '-EXIT-'):
            break
    win2.close()


if __name__ == '__main__':
    main_window()


Screenshot, Sketch, or Drawing
Lenguaje dominante
Python
Estrellas
13.8k
Forks
1.8k
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PySimpleGUI/PySimpleGUI

Todos los issues de PySimpleGUI/PySimpleGUI

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.