PySimpleGUI / PySimpleGUI/PySimpleGUI
[Bug] no_titlebar=True crashes all the examples and my own programs on tkinter.
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)
Bug
Operating System
Archlinux
Python version
Python 3.9.1
PySimpleGUI Port and Version
4.32.1-1
Ports = tkinter, Qt, WxPython, Web
tkinter
PySimpleGUI Version:
4.32.1-1
tkinter version:
<module 'PySimpleGUI' from '/usr/lib/python3.9/site-packages/PySimpleGUI/init.py'>
4.32.1 Released 17-Nov-2020
8.6.10
3.9.1 (default, Dec 13 2020, 11:55:53)
[GCC 10.2.0]
Potential duplicate of:
https://github.com/PySimpleGUI/PySimpleGUI/issues/1577
Your Experience Levels In Months or Years
2 years Python programming experience
30 years Programming experience overall
Yes Have used another Python GUI Framework (tkinter, 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
- Try again by upgrading your PySimpleGUI.py file to use the current one on GitHub. Your problem may have already been fixed but is not yet on PyPI.
Description of Problem / Question / Details
no_titlebar=True
Code To Duplicate
Floating toolbar example:
window = sg.Window('Floating Toolbar', layout, no_titlebar=True, keep_on_top=True)
Traceback (most recent call last):
File "/data/stevef/scripts/pysimplegui/./toolbar.py", line 68, in <module>
Launcher()
File "/data/stevef/scripts/pysimplegui/./toolbar.py", line 36, in Launcher
(event, value) = window.read()
File "/usr/lib/python3.9/site-packages/PySimpleGUI/PySimpleGUI.py", line 7721, in Read
results = self._read(timeout=timeout, timeout_key=timeout_key)
File "/usr/lib/python3.9/site-packages/PySimpleGUI/PySimpleGUI.py", line 7842, in _read
Window._root_running_mainloop.mainloop()
File "/usr/lib/python3.9/tkinter/__init__.py", line 1421, in mainloop
self.tk.mainloop(n)
KeyboardInterrupt
Remove the no_titlebar=True and everything works perfectly.
A short program that isolates and demonstrates the problem (i.e. please don't paste a link to your 400 line program.... instead paste your 10 line program in full).
See above, floating toolbar example from the cookbook.
Yes, it is a pain to narrow down problems, but it's part of the debugging process. Help me help you by providing something that can be executed so that work on getting you a fix or a workaround can immediately begin.
#!/usr/bin/env python
print("Start")
import PySimpleGUI as sg
import subprocess
import os
import sys
"""
Demo_Toolbar - A floating toolbar with quick launcher One cool PySimpleGUI demo. Shows borderless windows, grab_anywhere, tight button layout
You can setup a specific program to launch when a button is clicked, or use the Combobox to select a .py file found in the root folder, and run that file. """
ROOT_PATH = './'
def Launcher():
def print(line):
window['output'].update(line)
sg.ChangeLookAndFeel('Dark')
namesonly = [f for f in os.listdir(ROOT_PATH) if f.endswith('.py') ]
sg.SetOptions(element_padding=(0,0), button_element_size=(12,1), auto_size_buttons=False)
layout = [[sg.Combo(values=namesonly, size=(35,30), key='demofile'),
sg.Button('Run', button_color=('white', '#00168B')),
sg.Button('Kate'),
sg.Button('Program 2'),
sg.Button('Program 3', button_color=('white', '#35008B')),
sg.Button('EXIT', button_color=('white','firebrick3'))],
[sg.T('', text_color='white', size=(50,1), key='output')]]
window = sg.Window('Floating Toolbar', layout, no_titlebar=True, keep_on_top=True)
# ---===--- Loop taking in user input (events) --- #
while True:
(event, value) = window.read()
if event == 'EXIT' or event == sg.WIN_CLOSED:
break # exit button clicked
if event == 'Kate':
os.system('kate')
elif event == 'Program 2':
print('Run your program 2 here!')
elif event == 'Run':
file = value['demofile']
print('Launching %s'%file)
ExecuteCommandSubprocess('python', os.path.join(ROOT_PATH, file))
else:
print(event)
def ExecuteCommandSubprocess(command, *args, wait=False):
try:
if sys.platwindow == 'linux':
arg_string = ''
for arg in args:
arg_string += ' ' + str(arg)
sp = subprocess.Popen(['python3' + arg_string, ], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
sp = subprocess.Popen([command, list(args)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if wait:
out, err = sp.communicate()
if out:
print(out.decode("utf-8"))
if err:
print(err.decode("utf-8"))
except: pass
if __name__ == '__main__':
Launcher()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Floating Toolbar example and inspect PySimpleGUI.py around lines 7721 and 7842, where the traceback enters tkinter's mainloop. Run the provided example with no_titlebar=True on the reported tkinter setup and compare it with the working titled-window case. Done means the borderless example no longer hangs or crashes while retaining its intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100