Is there an option available to change the Pygame logo in the title bar of a Pygame window to my own program logo?
Yes, you can use pygame.display.set_icon():
pygame.display.set_icon()
Change the system image for the display window
set_icon(Surface) -> None
Sets the runtime icon the system will use to represent the display window. All windows default to a simple pygame logo for the window icon.
You can pass any surface, but most systems want a smaller image around 32x32. The image can have colorkey transparency which will be passed to the system.
Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set.
Related
I have a windows application with toast notifications (using Windows.UI.Notifications.ToastNotification). The problem is that when the application has a dark icon and the dark windows theme is applied, the application icon is getting inverted colors in notifications (in popups and in action center). I'm talking about the icon in the attribution area according to this description. Is there any way to forbid the system to invert icon colors?
It looks like windows takes the decision to invert the icon or not according to the colors of the pixels on the border of the image. A little enlightening of border pixels do the trick and the system stops inverting the colors.
I couldn't find a document or hint which dimensions a statusbar or menubar icon in OSX should have. I found out that such an icon has 18x18 pixel for normal displays, but how to do that for retina displays? Is it 36x36 and are the usually naming coventions ...#2 working in this case?
The official apple docs covers informations of all other icon sizes, but nothing about a status bar icon.
From the docs:
When you create an icon to put inside a toolbar control in PDF format,
OS X will automatically scale your icon for high-resolution display.
You do not need to provide a high-resolution version.
there is no #2X version.
For freestanding icons in a toolbar, create inviting images that are
easy to identify. Because freestanding toolbar icons do not need to
fit within a toolbar control, you have a little more room to express
them. As you design a freestanding icon for your toolbar, follow these
guidelines:
Use a straight-on perspective. Make the outline sharp and clear. Use
anti-aliasing. Use color judiciously to add meaning. Create icons for
standard- and high-resolution displays. You need to supply two
resources: 32x32 and 32x32#2x. See Table 5-1 for the corresponding
canvas sizes. Use the PNG format.
For reference
Odd one, this. The project I'm working on includes some small icons (.ico file type) in a Windows resource (.rc) file, all 10x10 black on transparent.
Opening these icons in Visual Studio 2010 correctly brings up the icon editor, showing the icon in salmon-pink on teal-green. The icon's properties in VS show it as "10x10, 4 bit, BMP". The app that includes the icons displays them fine.
However, I cannot view or edit them in external editors! Windows 7 explorer's thumbnail view is blank white; MS Paint also loads them as 10x10 blank white images. Paint.Net (with the .ico plugin) thinks they're 10x10 transparent images. Windows file properties reports them as 10x10, 32-bit icons.
What's going on?
An icon contains 3 distinct bitmaps. Two monochrome ones and, in your case, a 4bpp bitmap. The monochrome bitmaps determine how the pixels are displayed. One of them determines whether a pixel is transparent, it shows up as teal green in the icon editor. The other determines whether a pixel is actually the background pixel inverted, it shows up as pink salmon in the icon editor.
So if you only see teal and pink then your 4bpp bitmap does not contribute anything at all to the visible icon. Whatever other icon viewer you are using to look at the icon is tripped up by that. Which is not unusual, inverting background pixels made only sense in the early days of Windows, back when displays had a very limited number of colors. Like 4bpp.
Fix it by using real colors in the 4bpp bitmap. Or don't worry about it if you are always displaying the icon on a well known background. Which is not typical btw, the user can change the color scheme setting for the window title bar for example. Or change the wall paper image for the desktop. The resulting icon color will be pretty random.
I'm writing a Windows application that displays its tray icon on the Windows system tray (next to the system clock). The problem is that my icon looks great on some backgrounds and looks horrible on others. One would solve this issue by creating a shadow or an outline around an icon, but the tray icon is just 16x16 pixels, which makes the former quite difficult to achieve.
So I was curious, is there a way to find out what system tray background is, that my icon is displayed on, as RGBA mean value, for instance? (I understand that it is now not a solid color, thus the word "mean".) And if so, I'm sure there's an algorithm to determine if it's a bright (gray, silver) vs. dark background (blue or black). This will let me load either dark or bright verson of my tray icon.
As you provide an icon only, you don't have an option to paint the area where the icon is supposed to be shown. With Aero off, the color is expected to be GetSysColor(COLOR_BTNFACE), otherwise things are more complicated and transparency involved so that windows underneath the appbar actually affect background color around system tray icon.
I have created a MATLAB GUI, which I would like to display so that it fills the whole screen. Currently, the titlebar is showing at the very top. Is there a way to hide this titlebar?
I considered using the psychtoolbox for this purpose, which allows for full screen displays, but this doesn't allow for standard MATLAB GUI elements to be included as I understand it.
(If it is of importance, this is for OSX. I would obviously hide the menubar before making the GUI fullscreen.)
I don't know if this will work for OSX, but on Windows I was able to use the Java code from this MATLAB newsgroup thread to create a full screen window with no title, edges, etc. and display an image in the middle. Here's how I made the window:
img = imread('peppers.png'); %# A sample image to display
jimg = im2java(img);
frame = javax.swing.JFrame;
frame.setUndecorated(true);
icon = javax.swing.ImageIcon(jimg);
label = javax.swing.JLabel(icon);
frame.getContentPane.add(label);
frame.pack;
screenSize = get(0,'ScreenSize'); %# Get the screen size from the root object
frame.setSize(screenSize(3),screenSize(4));
frame.setLocation(0,0);
frame.show;
And you can hide the frame again by doing this:
frame.hide;
Not sure how this would work in general for displaying a typical MATLAB GUI. I'll have to play around with it more and find out.