I am trying to know if there is a approach in python to read the tabs on the taskbar and get the list of them.
Suppose I have a task bar which has outlook,word,Skype minimized. I would like my code to get the list of things which are on taskbar.
Example:
Here if you notice outlook,slack,chrome,skype and notepad is open. So
what is the approach I need to follow to tell my code to return the
list of open things on taskbar.
Related
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.
I'm using pywinauto to interact with the window of an old game - specifically the dedicated server GUI. I've been able to connect to it with:
app = Application(backend="uia").connect(path=r"C:\Program Files (x86)\___.exe")
Using a loop, I'm able to read each line in a Listbox in a specific window using:
for i in dlg.ListBox.descendants():
print (i.window_text())
The Listbox behaves as like a console output area and I've also been able to write commands to the Edit (input) field which appear in the Listbox.
All of this is great considering I didn't think it would be easy at all!
However, the last part of what I'd like to do is proving more difficult...
I want to listen for changes in the list box so I can react to them and write different responses back into the Listbox. So for example, when a player joins the server, I want my code to know that a new line has appeared in the Listbox (so I can write a custom welcome message to the Edit field).
I have tried to look at listener scripts but I feel a bit out of my depth and can't seem to find a simple code example that could help me accomplish this. Does anyone have any ideas where I could look or what I could use?
Even better... would anyone be able to provide some sample code for me to re-work?
I'm fairly new to python, and I am trying to run the code I wrote when I right click the playback range windows in the timeline of maya (where you type your min or max range) . I managed to find ways to run scripts within the attribute editor / timeline / shelf items, but I cant seem to figure out how to interact with Maya's UI... Even typing a new value in there doesn't update the script editor, so I don't really have a lead on where to go. Any help would be fantastic!
you basically want to add a menu item in the timeslider ?. You can get all maya widget using OpenMayaUI.MQtUtil and here is a full repo which modify timeline control https://github.com/robertjoosten/maya-timeline-marker
Everything Maya does when using the UI logs data in the script editor.
Many items in the log are suppressed though as it would spam the log.
To enable it, activate Echo all commands (can be found in script editor under History), then clear the script editor and perform the action you want logged.
You will find that Maya executes a lot of mel script functions, which you can all find in the maya install directory under [MAYA_INSTALL_DIR]/scripts/startup and [MAYA_INSTALL_DIR]/scripts/others
To find the essential function you will have to search a little through the log.
Once you got a mel function you want to look for, I recommend using a find in files search function like the one in Notepad++, to find the corresponding .mel file in which the global proc is defined.
Also note that UI element names that are logged in script editor may have a different name the next time you start maya. So you will have to add functionality to search for the correct UI element name.
The Maya mel scripts are a good resource to find out all sorts of things about how the UI works, including contextual marking menus and the commands of tool windows.
I have this program that stores some information about my books, and this information is shown in windows, that appear whenever I double-click a book title in a list. But there is the possibility of searching for a book using it's title or author, and that can make the program open multiple windows. My problem is, all the windows are opened one over the other, and, until the I move a window, or close it, it seems that only one window was opened. Is it possible to, with python and tkinter, make the windows appear in slightly different positions?
You can use the geometry method of a window to specify where you want it to appear. For example, w.geometry("+100+200") will open the window w at coordinate 100,200. Each time you open a new window, adjust the coordinates appropriately.
Normally, though, this is something the window manager does for you. It's odd that it's not doing this for you.
The geometry method is documented here, among other places: http://effbot.org/tkinterbook/wm.htm#Tkinter.Wm.geometry-method
Beginner python learner here. I have a question that I have tried to Google but I just can't come up with the proper way to ask in just a few words (partly because I don't know the right terminology.)
How do I get python to detect other widgets? For example, if I wanted a script to check and see when I click my mouse if that click put focus on an entry widget on a (for example) website. I've been trying to get it to work in Tkinter and I can't figure out even where to begin.
I've seen this:
focus_displayof(self)
Return the widget which has currently the focus on the
display where this widget is located.
But the return value for that function seems to be some ambiguous long number I can't decipher, plus it only works in its own application.
Any direction would be much appreciated. :)
Do you mean inside your own GUI code, or some other application's/website's?
Sounds like you're looking for a GUI driver, or GUI test/automation driver. There are tons of these, some great, some awful, many abandoned. If you tell us more about what you want that will help narrow down the choices.
Is this for testing, or automation, or are you going to drive the mouse and button yourself and just want something to observe what is going on under the hood in the GUI?
>How do I get Python to detect other widgets?
On a machine, or in a browser? If in a machine, which platform: Linux/Windows (which)/Mac?
If in a browser, which browser (and major version)?
> But the return value for that function seems to be some ambiguous long number I can't decipher
Using longs as resource handles is par for the course, although good GUI drivers also work with string/regex matching on window and button names.
> plus it only works in its own application.
What do you mean, and what are you expecting it to return you? You should be able to look up that GUI object and access its title. Look for a GUI driver that works with window and button names.
Here is one list, read it through and see what sounds useful. I have used AutoIt under Win32, it's great, widely-used and actively-maintained; it can be called from Python (via subprocess).
Here are comparisons by the author of PyWinAuto on his and similar tools. Give a read to his criticisms of its structure from 2010. If none of these is what you want, at least you now have the vocabulary to tell us what would be...