I would like to begin by thanking you all for taking time to try and help me out. For my dissertation project I have decided to make a network topology program (similar to somthing like Cisco packet tracer or GNS3) My program also has the added benifit of a subnet calculator. I have the basic layout complete and I feel rather confident that I will definitly complete this program, but due to a lack of information on the web regarding wxPythons drag and drop feature, I cant find anything which is specific to what I need.
What I would like is a column, or some sort of area within my frame that the user is able to select things like routers, switchs, servers, IP phones and hosts etc etc. They then have the ability to drag these network items from the column onto the topology area. They should then be able to double click the item and a new form pop up. the user can then give the item an ip address etc etc.
Please do not think I am asking for someone todo this for me, I am simply wondering if someone could help me out by suggesting wxPython tools that could suit the needs that I have stated. If anyone has had experience with this kind of thing then please could you shed some light on it for me. I would be more than happy to produce my code online if you should need to see it.
Thank you in advance for your time.
There are Drag and Drop examples in the wxPython demo. Also see http://wiki.wxpython.org/DragAndDrop or http://zetcode.com/wxpython/draganddrop/
Depending on how you're displaying your information in the topology area will decide how to make double-click function. For the most part, you either bind to the widget's double-click event or it's selection event and act accordingly in its handler to display the dialog or frame. When you can tell us what widget we're double-clicking on is when we'll be better able to answer that question.
Related
I have a script that is used to login in to a company-made application and click the right buttons like "continue", or "ok", etc. to perform a certain process. However, I have had to use screenshots of these buttons to click in order to do this using pyautogui. Is there any package or way to automate this process without using images. Maybe it can detect the text of the button and click it. I do not have identifiers for the buttons available and no access to the code/info behind the application. Let me know if you have any ideas. Thanks!
I have a few questions that may be helpful:
Does the layout of the buttons change? If it's always the same you can just program the correct locations and timing and not worry about reading the screen.
If you really have to read the screen, look into optical character recognition (ocr).
Is the application keyboard accessible? If so, using Tab and Enter to activate the buttons is simpler than controlling the mouse. Also, if it was made by superstars you can use find (ctrl-F) to search for the text on the buttons and go to them.
This answer is pretty vague, but I can only be as specific as the question asked.
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 have been implementing in a drop down menu (offically called a "Tkinter.OptionMenu") inside my application, that once clicked open will allow users to skip to certain parts of the form (like skipping to a certain chapter of a book/play). I want to be able to OPEN that drop down menu on an event i.e with code however as much as i have searched, it seems the very best i can do i to do a .focus_set() which is better than nothing, but all it does it place a faint outline around the widget. I would like it to fully open it up, just as if the user had clicked on it.
I'm pretty sure that i'm missing something simple, but help would be appreciated :)
Edit: Yes, i do have good reason to programatically open it, and even if i didn't it would still be nice to find out. I do not need access to the functions the list gives, but rather, i need the user to pick something from that drop down, and so i would like to open it for them
I created an complete logger-type program, that logs the certain data from the internet sources. It's GUI I coded in wx.python, now I want to daemonize it (if it is the right term). The program needs to run in background and user has to have option to call/open GUI when he pleases. How can I achieve this with wx.python?
I wouldn't really "daemonize" it per se. Instead, I would just put it in the system tray...at least, that's what I would do on Windows. I assume you can do something similar on the other OSes. Basically you want to bind the frame to wx.EVT_ICONIZE and in that method, you hide it. Then when the user double-clicks the taskbar icon, you want to show it and probably Raise it too.
There's some badly formatted code here: http://bytes.com/topic/python/answers/699757-wxpython-how-minimize-taskbar (I've used a variation of it myself, so I know it works).
And here's some information on Task bar icons: http://www.blog.pythonlibrary.org/2011/12/13/wxpython-101-creating-taskbar-icons/
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...