How can I set the mac osx default button in tkinter - python

I am using TkInter to develop a simple application for Mac OSX in python.
I am wondering how to set the 'default button' for a dialog in tkinter. See the human interface guidelines to see what this means.
Is this even possible?

Both the Button and ttk.Button widgets have a default attribute. Setting it to "active" should give you the visual appearance you are looking for. You will need toset the focus to that button and/or add a binding on <Return> to invoke the button.

Related

Open new window - tkinter/tk taskbar/dock

How can I can a function and create a function for the icon context menu? I want to make the iconic Open New Window function pop-up when you right click on the icon menu in the taskbar/dock. See this question for more info on this kind of question.
Places I have looked but found nothing:
https://www.tcl.tk/man/tcl8.5/TkCmd/tk_mac.html#M15
https://pyinstaller.org/en/stable/feature-notes.html#open-event-handling-in-a-tkinter-based-gui-application
While there are a tiny subset of apple events that you can benefit from the DockMenu is not accessible directly via tkinter. Turns out mac is not really open for modifications and even smaller tasks can be hard. You could consider to use a system tray icon instead.

automatically start typing in tkinter Entry

I'm trying to make a input screen with Tkinter that will when i type automatically receive my input without me having to click it first. would this be possible?
I wasn't able to find a tutorial or text document online to do this, and hope someone can help me with this problem! I'm on Windows 10 (bootcamped on a mac) with Python 3.8.3 64-bit.
The concept you are looking for is called "focus". When you type, the widget with the focus will receive the keypress events. So, to let you immediately type into an entry widget, force the UI to set the focus to that widget by using focus_set:
the_entry = Entry(root, ...)
the_entry.focus_set()
When the window as a whole is focused (ie: brought to the front), this will cause the keyboard focus to be set to the entry widget.

Pywintauto findbestmatch alternative

I am working with Pywinauto to automate a Desktop Application.
At one point there could be a popup window. With findbestmatch I want to check if the popup is available. The name of the popup window is the same as of the normal window.
Is there an alternative for findbestmatch or is it the best option?
There is a pywinauto function called popup_window() which could be a good starting point for you. See link
Its listed under pywinauto.controls.hwndwrapper, which provides basic wrapping of windows controls. It will return the handle/id of any open popups or a reference to self if no popups exist.

Create a click through window for Linux

I want to make a click through window. A window which I click but the click pass to the window below it.
I've found this two solutions for windows:
How to make click-through windows PyQt
I have a form that can "click through", i.e. direct clicks to the window below. How can I undo my changes after the event?
But I want it to work in linux. I study the xlib mechanisms but cannot understand how the window stack works. Actually I can get all the windows with XQueryTree() and found the ones under my window. But I don't know witch one are above.

highlighting a window in GNOME's window list

In order to indicate activity, some applications (e.g. Pidgin) highlight their entry in GNOME's Window List panel widget (e.g. via bold font or flashing color). This indication is reset automatically when the window is activated.
I have a terminal application for which I would like to achieve the same thing (preferably via Perl, but Python would work too) - but I have no idea where to start. I imagine I'd first have to find the terminal window (based on window title) and then trigger some kind of GTK action.
Any help would be greatly appreciated!
In a GTK application, use gtk_window_set_urgency_hint(). If you have a terminal application, you can't really do that - with libwnck you can get information about other application's windows, but as far as I know you can't get a GtkWindow pointer to another application's window.
May I suggest using the terminal beep? Of course this isn't a sure way to attract the user's attention, but some terminals are able to flash the title bar instead of beeping, or such things.
I'm not really into GTK programming, but as far as i know you want to set an "URGENT"-Flag for the Window which should be highlighted. Maybe this will get you any further. :)

Categories

Resources