PySimpleGUI / PySimpleGUI/PySimpleGUI

[Question] Keep 2nd window on top of others, works in Windows but not Raspberry Pi OS

Open
#4,337 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

Question


Operating System

Raspberry Pi OS 32 Bit - latest

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()

Python version (sg.sys.version)

3.7.3

PySimpleGUI Version (sg.__version__)

4.43.0

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

Python version: 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0]
port: tkinter
tkinter version: 8.6.9
PySimpleGUI version: 4.43.0
PySimpleGUI filename: /home/pi/.local/lib/python3.7/site-packages/PySimpleGUI/PySimpleGUI.py


Your Experience In Months or Years (optional)

Years Python programming experience
Couple
Years Programming experience overall
Hobby
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
tkinter
Anything else you think would be helpful?


Troubleshooting

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

  • [y ] Searched main docs for your problem www.PySimpleGUI.org
  • [ y] Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
  • If not tkinter - looked for Demo Programs for specific port
  • [y ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
  • Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description

Keep 2nd window on top of others in Linux -- works in Windows but not Linux

Attempting to keep 2nd Keypad window on top of others in multi window program.
Works without issue On MS-Windows but Not on Linux.
This is similar to question asked on https://github.com/PySimpleGUI/PySimpleGUI/issues/3719
Tried using win.TKroot.wm_attributes("-topmost", 1) from other web searches but not working in Linux
Any help would be appritiated.
Thanks - Dan

Code To Duplicate

A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

This pre-formatted code block is all set for you to paste in your bit of code:

import PySimpleGUI as sg
sg.theme('LightGreen5')
btn_font = "'Helvetica', 10"
input_font = "'Helvetica', 13" 
label_font = "'Helvetica',   13"

def keypad_input(window):
    layout = [[sg.Button(i, size=(5, 2)) for i in j] for j in ("123", "456", "789", "<0C")] + [
                [sg.Button("Enter", size=(26, 2))]]

    win = sg.Window('OrderNo',layout, no_titlebar= True, keep_on_top=True,  modal=True, finalize=True)
    win.TKroot.wm_attributes("-topmost", 1)

    buffer = ''
    while True:
        event, values = win.read()   
        if event == 'Enter':
            win.close()
            return buffer
        elif event in "0123456789<C":
            if event == '<' and len(buffer) > 0:
                buffer = buffer[:-1]
            elif event == 'C' and len(buffer) > 0:
                buff_length = len(buffer)
                buffer = "" # buffer[:-1 (buff_length)]
            elif event != "<":
                buffer += event
                
        window['_OrderNo_'].update(buffer)
  
def main():
    layout = [[sg.Button('Order Number'),sg.Input('', key='_OrderNo_', size=(5, 1), font=input_font)],
               [sg.Button('Exit')]]

    window = sg.Window('Test1', layout, size=(1200, 800), finalize=True)

    window.Maximize()
    
    while True:             # Event Loop
        print("loop")
        event, values = window.read()
        if event == sg.WIN_CLOSED or event == 'Exit':
            break
        if event == 'Order Number':
            keypad_input(window)
          
    window.close()

if __name__ == '__main__':
    main()
Screenshot, Sketch, or Drawing

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

Start with the supplied keypad_input example on Raspberry Pi OS 32-bit using Python 3.7.3, PySimpleGUI 4.43.0, and tkinter. Reproduce the behavior around keep_on_top, modal, and win.TKroot.wm_attributes("-topmost", 1), then compare it with Windows; done means the second keypad window remains above other windows on Raspberry Pi OS.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, raspberry-pi
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.