Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Create function PySimpleGUI.KillLinux() using code found in window.Disable() (freezes entire environment) #1485

Open
klieret opened this issue May 28, 2019 · 9 comments

Comments

@klieret
Copy link

@klieret klieret commented May 28, 2019

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

Bug:

  1. Initialize Window
  2. Show it (window.Read())
  3. Run window.Disable()
  4. The whole desktop environment freezes, nothing is clickable anymore
  5. Change to tty terminal and kill application
  6. Things are normal again

Operating System

Ubuntu 16.04 LTS 64 bit

Python version

Python 3.5.2

PySimpleGUI Port and Version

PySimpleGUI==3.35.0

Code or partial code causing the problem

Minimal example (freeze occurs after 'OK' is clicked):

#!/usr/bin/env python3
import PySimpleGUI as sg
window = sg.Window('Get filename example'). Layout([[sg.OK(), sg.Cancel()] ])
while True:
    window.Read()
    window.Disable()
@klieret klieret changed the title window.Disable() freezes whole Desktop environment window.Disable() freezes whole desktop environment May 28, 2019
@MikeTheWatchGuy
Copy link
Collaborator

@MikeTheWatchGuy MikeTheWatchGuy commented May 28, 2019

Wow!
What a cool capability!

I'll work on it.... but will rename existing window.Disable() to window.CleanupLinux() ;-)

Thank you for taking the time to fill out the form so completely.

It's greatly appreciated and ensures you're problem received priority treatment (it helps having code too like you posted!)

@klieret
Copy link
Author

@klieret klieret commented May 28, 2019

Yes, I'm quite amazed by this, too 😄

I tried the ssame on another Ubuntu 16.04 machine and also tried python 3.6.6 but it's the same issue. I'm surprised that this is even possible, but have no idea how to investigate this any further.

@MikeTheWatchGuy MikeTheWatchGuy changed the title window.Disable() freezes whole desktop environment [Enhancement] Create function PySimpleGUI.KillLinux() using code found in window.Disable() (freezes entire environment) May 29, 2019
@Darklight-user
Copy link

@Darklight-user Darklight-user commented Feb 6, 2021

Can I work on this issue? if this is not assigned to anyone?

@jason990420
Copy link
Collaborator

@jason990420 jason990420 commented Feb 6, 2021

Long time passed, not sure what state the issue is now.
It's better with a new issue for it and issue form filled to confirm the situation to happen.

Anyway, it still need to wait PySimpleGUI/Mike back to work on them.

@PySimpleGUI
Copy link
Owner

@PySimpleGUI PySimpleGUI commented Feb 6, 2021

I think I'm missing something most likely.... if so, I'm sorry about that.

Maybe these will help until I can return....

Tip #1 - don't call

window.disable()

Tip #2 - you don't need to wait for change to the package to implement workarounds yourself.

import PySimpleGUI as sg

def my_func(*args):
    sg.popup("don't call window disable please")

sg.Window.disable = my_func

def main():
    window = sg.Window('Window Title', [[sg.Button('Go'), sg.Button('Exit')]])

    while True:             # Event Loop
        event, values = window.read()
        if event == sg.WIN_CLOSED or event == 'Exit':
            break
        if event == 'Go':
            window.disable()
            
    window.close()

if __name__ == '__main__':
    main()

THANK YOU for your patience.... everyone....

@PySimpleGUI
Copy link
Owner

@PySimpleGUI PySimpleGUI commented Feb 6, 2021

👆🏼
Sarcasm mixed with trying to be actually helpful. I hope it's read as such. It is meant to be helpful.

@PySimpleGUI
Copy link
Owner

@PySimpleGUI PySimpleGUI commented Feb 6, 2021

This issue is quite old. The worst that should happen is an exception due to the bad attribute "-disabled"

Go {}
Traceback (most recent call last):
  File "/home/mike/PycharmProjects/pythonProject/test.py", line 26, in <module>
    main()
  File "/home/mike/PycharmProjects/pythonProject/test.py", line 22, in main
    window.disable()
  File "/home/mike/PycharmProjects/pythonProject/PySimpleGUI.py", line 8826, in disable
    self.TKroot.attributes('-disabled', 1)
  File "/usr/lib/python3.8/tkinter/__init__.py", line 1967, in wm_attributes
    return self.tk.call(args)
_tkinter.TclError: bad attribute "-disabled": must be -alpha, -topmost, -zoomed, -fullscreen, or -type

Process finished with exit code 1

That should not / will not freeze an entire environment.

@Darklight-user do you have a specific solution in mind? I'm listening.

@jainismvivek
Copy link

@jainismvivek jainismvivek commented Mar 26, 2021

from tkinter import *
#import os
#path = 'G:\Zone 1\Vs Code'
#Image_path = os.path.join(os.path.dirname(file),path)
window = Tk()
window.geometry("420x420")
window.title("interface")
icon = PhotoImage(file= 'Dual.png')
window.iconphoto(True, icon)

window.mainloop()

guys i am running this code but it is showing error can anyone tell me what's wrong even the img file is in the same folder.. its showing error in init.py file. i even tried to run it with those line that i am showing them as comments for now.

@jason990420
Copy link
Collaborator

@jason990420 jason990420 commented Mar 26, 2021

Here's not the right place to talk about tkinter issue. but it look like wrong path for your png file.

file= 'Dual.png'
Image_path = os.path.join(path, file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants