jaredks / rumps

Ridiculously Uncomplicated macOS Python Statusbar apps
BSD 3-Clause "New" or "Revised" License
3.06k stars 177 forks source link

[NSApplication macOSVersion]: unrecognized selector sent to instance 0x7f8377491740 - PySimpleGUI #165

Closed phatmandrake closed 2 years ago

phatmandrake commented 2 years ago

I'm trying to use rumps with PySimpleGUI (tkinter) to prompt someone for password information when they click on a menu item.

import rumps
import PySimpleGUI as sg

class APP(rumps.App):

    def __init__(self):
        super(APP, self).__init__("APP")
        self.menu = ["Connect"]

    @rumps.clicked("Connect")
    def Connect_Button(self,sender):
        sg.popup_get_text( 'Enter Password:', password_char='*')

if __name__ == "__main__":
    APP().run()

This generates the error. popup_get_text works as expected if it's used outside of the class.

Edit: This is happening with just using tkinter as well. so I'm guessing it's a limitation.

import rumps
import PySimpleGUI as sg
import tkinter as tk
import tkinter.simpledialog

class APP(rumps.App):

    def __init__(self):
        super(APP, self).__init__("APP")
        self.menu = ["Connect"]

    @rumps.clicked("Connect")
    def Connect_Button(self,sender):
        tk.Tk().withdraw()
        test = tkinter.simpledialog.askstring("Password", "Enter password:", show='*')
        return test

if __name__ == "__main__":
    APP().run()