How do I add an icon to my app in wxpython? - python

I'm messing around with wxpython and I want to make a good app, and I want an icon for my app. (I mean on the actual window not the taskbar.)
I've already read How to set icon on wxFrame?. But where do I put the path to my icon in the wx.EmptyIcon()?
I really don't understand how to do this. Any help?
Sorry for the bad english!

Alright, for anyone who wants to know, I figured it out. You need to use this code:
frame.SetIcon(wx.Icon("C:\\Users\\JScripter98\\Downloads\\scissors.png"))
(the path can be anything you want)
This sets the icon to your main frame. The path should have two \'s in it so python knows it's a file path.

Related

Pywinauto find process window and focus it

My current situation is that I open a process, which opens in a random location (thats how this process works).
I have the process PID so I need to somehow focus this window, and move it to the center of my screen.
Im doing something wrong as I can't even set focus on that window... tried it with different apps and got the same result...
The way I select the window -
appl = pywinauto.application.Application()
appl.connect(process=824)
app_dialog = appl.top_window_()
app_dialog.Minimize()
app_dialog.Maximize()
##app_dialog.SetFocus() ##doesn't work aswell
##pywinauto.win32functions.SetForegroundWindow(app_dialog)## doesn't work
Thanks for reading :)
Can't say why it doesn't work with pywinauto...
Got it to work with win32gui as the answer here- Python Window Activation
long yet efficient ;)
Method app_dialog.set_focus() should work in pywinauto 0.6.2. If not, it might be a bug. Is your application publicly available somehow? I'd like to reproduce it on my side. Are you trying to activate a background window while you have modal dialog on top of it?
Second case is a wrong usage of SetForegroundWindow(...). It should give a handle, but you pass WindowSpecification object app_dialog. Right way is the following:
handle = app_dialog.wrapper_object().handle
pywinauto.win32functions.SetForegroundWindow(handle)

Textedit + CombBox + pyqt4

I need help with a program. I need use a texedit + combobox.
I need open a txt and set it to my textedit ( i've alredy did it)
than i need use my cursor, to get some word, than use a specific thing in my combobox... for example Polarity, this box have only numbers, 1,-1,0
and with a button, i need save it on a new txt or other archive.
I have a menu bar with open,new,save and close. I can open a file modify it and save, but i want to save with a buttom, the word that i underline(with cursor) + the number i selected and saved for that word.... it's possible? how i can do it?
It's better using table widget? im new using pyqt4 :(
please help me... i dont know how to do this thing ..
The best way to get started with PyQt4 is to look at some working examples that are similar to the application you want to write. The PyQt4 source has lots of these - download it from here, and have a look in the examples directory.
In addition to this, there are numerous tutorials available that will help get you started. A good place to start looking is the PyQt4 wiki.
Once you've worked through a few tutorials, you will probably be able to achieve what you want quite easily. And if you get stuck on something, you can always come back and ask about it on SO (just make sure to ask a specific question, and post the code that you have so far).

How can I set an icon for a quickly application?

How can I set an applications image (icon) in my canonical-quickly project? Even if I set the icon path in Glade, the UI designer, my icon doesn't show up.
In the aplications bar of my desktop I only see a gear.
I used the following relative path in Glade:
../media/projectname.svg
It's been a while but anyway...
You should put it here:
YOUR_QUICKLY_PROJECT_FOLDER/data/media/YOU_PROJECT_NAME.svg
(.png/.jpg might work also, I am not sure)
And you don't need to set it anywhere in the programme.

How to set the screen resolution in pythoncard

I want to set the resolution of my application as per the resolution of the system screen its running on. i want to be on top and also in full screen covering even the taskbar as i am using windows. i want the app to open like the ATM interface, so the app should fill the entire screen.
please help me to find the solution.
thanks
The frame object has a "ShowFullScreen" method that you could use. I just tested it and it works alright, although it doesn't show the title bar of the app. I don't know if you care about that though.
EDIT: Uh, to call a method on the frame object, you would do something like
self.ShowFullScreen(True)
or
myFrame.ShowFullScreen(True)

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