PySimpleGUI / PySimpleGUI/PySimpleGUI
[Bug] no_titlebar=True crashes all the examples and my own programs on tkinter.
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 13.8k
- Fork
- 1.8k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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()
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ví dụ Floating Toolbar và kiểm tra PySimpleGUI.py quanh các dòng 7721 và 7842, nơi traceback đi vào tkinter's mainloop. Chạy ví dụ được cung cấp với no_titlebar=True trên thiết lập tkinter đã được báo cáo và so sánh với trường hợp cửa sổ có tiêu đề đang hoạt động. Được xem là hoàn tất khi ví dụ không viền không còn bị treo hoặc gặp sự cố, đồng thời vẫn giữ nguyên hành vi dự kiến.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- desktop
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100