Python GTK: make about dialog without logo - python

GNOME Developer Center website shows About Dialog without an icon. On Ubuntu 16.04 LTS however, it seems that GTK now requires for icon to be present, as without explicitly declaring icon name, that very same example form the website it shows error icon.
Thus the question: how do I get around this issue ? I want the About dialog for my program only have simple text and no icon/logo.

I know I'm a little late to the party but I just stumbled upon your question because I was too searching for an answer to this. What worked for me was this:
about = Gtk.AboutDialog() # Create your about dialog object
about.set_logo_icon_name(None)
By passing None to set_logo_icon_name the default window icon set with the gtk.window_set_default_icon_list() function will be used. If you haven't specifically specified a default window icon then no icon/logo will be rendered.

Related

Hiding the Taskbar in Windows10, Using Python

We are having a prank competition at the office, and we are only allowed to use Python.
the prank involves: taking a screenshot of the Desktop, Moving all the Apps from the Desktop, and using the screenshot as the new wallpaper (I Hope U got it).
The issue is I'm not able to make the taskbar disappear, so they can open the Apps with the taskbar.....
I need a way to hide the taskbar (in any way or form)
TNX
nircmd.exe win hide class Shell_TrayWnd
nircmd.exe win show class Shell_TrayWnd
try running with subprocess in python

Change wxpython program's default title and icon in dialog box

I want to change the title of my program from its default "Python" to lets say "MyProgram". Also, if I choose "About" from this menu, the dialog box comes up with a picture of the Python logo. How can I change that image?
Pictures for reference:
http://i.imgur.com/iop5f0q.jpg
http://i.imgur.com/XjagYBA.jpg
I'm pretty sure you have to create an app bundle with py2app to get that changed. Otherwise it just defaults to Python.
See the following answer:
Changing WxPython app Mac menu bar title?
According to that, you will have to also make sure that the plist file is filled out correctly.

wxPython windows stuck in background

I have a wxPython project that is showing some weird symptoms in Windows 7 (everything works fine on Mac OS X, Windows 7 is the only win version we're testing against for this version). The app has a subclass of wx.TaskBarIcon with a right-click menu that should create windows that should always stay on top. Each window is a subclass of either wx.Frame or wx.Dialog created by wxFormBuilder.
Sometimes, and I cannot find the steps to reproduce it, the windows don't show up and cannot be called to the front. The app's icon will appear in the taskbar but the window will not appear. Clicking the icon does nothing and even by closing all other windows the window is not shown.
Snippet of how I'm currently showing the window:
#Initialization code, calling super's __init__ etc.
self.Center()
self.Show()
self.SetWindowStyle( self.GetWindowStyle() | wx.STAY_ON_TOP )
Since I can't reproduce the problem debugging it is hard. I've tried calling self.Raise and self.SetFocus after self.Show but the problem comes up again now and then. Has anyone experienced similar problems with wxPython or know any possible fixes for this?
As I recall, you normally can't change Frame styles after initialization reliably. You should just put the STAY_ON_TOP style flag in the Frame's init instead. For dialogs, use ShowModal(). Now that I think about it, you can also use the frame's MakeModal() method and that would probably work too.

How to move application window to current workspace?

My application has "Bring to current desktop" option in indicator menu. Now, moving windows across workspaces is nice and easy if you are not using Compiz.
My question is how could I bring application window to current desktop. Application is written in Python and GTK+. I tried using Present method of gtk.Window but then window grabs focus and nothing else happens (window is not actually presented to user). I also tried playing with wnck, but that method works only when Compiz is not running.
Any idea?

How to change the OSX menubar in wxPython without any opened window?

I am writing a wxPython application that remains open after closing all of its windows - so you can still drag & drop new files onto the OSX dock icon (I do this with myApp.SetExitOnFrameDelete(False)).
Unfortunately if I close all the windows, the OSX menubar will only contain a "Help" menu. I would like to add at least a File/Open menu item, or just keep the menubar of the main window. Is this somehow possible in wxPython?
In fact, I would be happy with a non-wxPython hack as well (for example, setting the menu in pyobjc, but running the rest of the GUI in wxPython). wxPython development in OSX is such a hack anyway ;)
UPDATE: I managed to solve this problem using the tip from Lyndsey Ferguson. Here's what I have done:
On startup I create a window which I show and hide immediately. I set its position to (-10000,-10000) so that it does not flicker on the screen (aargh, what a dirty hack!)
I create an empty EVT_CLOSE event handler in that window so that it cannot be closed.
It seems that destroying a window resets the OSX menu, but hiding does not... So when the last window is closed, I need to show and hide this window again (hiding is necessary so that the user cannot switch to this window using the Window menu or Cmd-`)
Yeah, this is really ugly... I will be very grateful if someone comes up with a prettier solution.
UPDATE 2: Actually it can be solved in a much easier way: if we do not close the last window, only hide it. And ensure that it does not respond to menu events anymore.
Nowadays you can use wx.MenuBar.MacSetCommonMenuBar() to set the menu bar (which you have to create) that should be used when no windows are open.
If you just want a default macOS menu bar to be used (with the application and Window menus already there), this appears to be the minimal code:
menubar = wx.MenuBar()
wx.MenuBar.MacSetCommonMenuBar(menubar)
This will let your app respond to Command+Q out-of-the-box, too.
The wx.MenuItem IDs wx.ID_ABOUT and wx.ID_EXIT are special as menu items with those IDs are moved to the macOS Application menu. The docs actually refer to the application menu as the "Apple" menu (e.g. the menu described in the wx.MenuBar.OSXGetAppleMenu() function's docs is the application menu), possibly for historical reasons.
Can you create a hidden window that is offscreen somewhere? It is a hack, but I remember having to do a lot of hacks to make my wxPython-based application work correctly on Mac OS X.
Note:You'll have to disable the close button and set up that hidden window so that it doesn't show up in the Window menu.
Aside:Have you considered factoring out your GUI portion of your Python application and using PyObjC on Mac OS X? You'll get more native behaviours...

Categories