set window icon tkinter macosx - python-3.x

This line works fine for my Windows program.
When i run this same file on the Mac OS X, I get a blank page instead of my icon.
Here is the windows line:
self.iconbitmap("Boss.ico")
I have searched relentlusly for an answer I want this icon to work on both platforms. self is the root Tk window if your wondering if it's root or not.
Note: I have tried using icns, .xbm , .gif by loading a photo image and setting thru window attributes all produce the same blank page on the mac.

After 5 days of searching, and this post having been viewed at least 15 times I went directly to the tk/tcl documentation. If I understand this correctly, apparently there is no way to properly set the icon for mac OS X without using special library or other sort of hacks. It would be nice if there were a mac specific documentation for the tkinter library but alas there isn't that I have found. here is the part of the documentation I found:
wm iconphoto window ?-default? image1 ?image2 ...? Sets the titlebar
icon for window based on the named photo images. If -default is
specified, this is applied to all future created toplevels as well.
The data in the images is taken as a snapshot at the time of
invocation. If the images are later changed, this is not reflected to
the titlebar icons. Multiple images are accepted to allow different
images sizes (e.g., 16x16 and 32x32) to be provided. The window
manager may scale provided icons to an appropriate size. On Windows,
the images are packed into a Windows icon structure. This will
override an ico specified to wm iconbitmap, and vice versa.
On X, the images are arranged into the _NET_WM_ICON X property, which
most modern window managers support. A wm iconbitmap may exist
simultaneously. It is recommended to use not more than 2 icons,
placing the larger icon first.
On Macintosh, this currently does nothing.
if anyone has a working solution please post this. I want to accomplish this so that any system can open a freshly installed python and run my application without installing any additional library.

#GarryHurst This is not a solution but I sort of get the idea now:
On Mac, TK decided that the icon will never appear on the window title bar.
Instead, it shows up as the app's Dock icon.
It's most probably a by-design or won't fix issue on their side.

It is showing the icon of the file you are putting in the directory so setting the file to be an app will set the window icon to be the icon of that app.
for example:
root.iconbitmap("/Users/homedir./Desktop/Test apps/Clicker.app")
tk window with icon

I have a coup. Why not change mind, like this.
The emoji library is enough to choose a good-looking icon.
We can do that.:-D
Code
Effect

Related

Displaying a Classification Banner at the top of each computer monitor in Gnome Desktop

I work in an environment where we have to have a security classification banner displayed at the top of each monitor on our Gnome Desktops. Currently, I am using a Perl/Tk window to display the classification of the system. However, that window cannot be moved because of the way it is built (no decorations) and occasionally overlays open windows making it difficult for users to manage those windows.
I would like to be able to do something different, but I'm not sure where to start. Three ideas I have are this:
An icon or something in the Top Bar showing the classification
A banner, like the Top Bar, that sits above the Top Bar
A window, like I already have, but relocatable
I figure the first option would be easiest, but since the Top Bar isn't shown on every monitor, that may not be the best option. I don't even know if the second option is even possible. The third option would require me to use something other than Perl/Tk but that's the only language I'm fluent in at the moment.
So I'm looking for suggestions or examples or Gnome extensions I can use to solve this problem.
Thanks.
There is a classification-banner python utility at https://github.com/fcaviggia/classification-banner. It's no longer maintained, but we've been using it without change for a few years now. It's OK. One problem is that it doesn't "shrink" the desktop screen, so application windows can overlap it; it's set to Always On Top, but it would be nicer if it actually couldn't be overlaid at all.
A simple solution, of sorts, would be to change the desktop background image. This can have issues if you're displaying on multiple resolutions (I don't know if Gnome supports SVG for such purposes) and of course it can be obscured by windows covering it.
Older versions of Gnome let you create multiple bars that worked perfectly, but that disappeared - along with many other customizations - in Gnome 3.

QGIS 3 - how to change size of attribute window?

When adding a new feature to a shape file in QGIS 3.4.4. the attributes dialog opens only as a tiny window regardless of the length or number of the attribute columns in the list. I can manually adjust the size of the window but when I add the next features it is tiny again. That soon gets very annoying when many features need to be added.
Here an example screenshot:
Is this a bug or can I somewhere change the settings so that the window automatically opens at an appropriate size? I am running QGIS 3 on MacOs High Sierra 10.13.6.
This is a pretty old post but I was having the same issue so I figured I would post how I fixed it. It might have been patched in later releases because I saw there was a bug report submitted.
I'm Running QGIS 3.8 on mac.
open layer properties, navigate to attributes form (icon below source fields). On the top left drop down menu change "Autogenerate" to "drag and drop designer"
This resolved my problem and the attributes form is full size. I had to repeat the process for all shapefiles I was working on.
default settings
settings to make it work

What causes control text to get cut off?

My VB6 application is having a layout problem on certain end user PCs, but so far we are unable to identify what is causing this.
Normal layout:
Broken layout:
The text on the left are the captions of the radio buttons. The text in the upper right is a label.
I am familiar with two different settings in Windows Control Panel which can affect text size, and initially we suspected this was the cause. In Windows 10, they are:
Control Panel >
Appearance and Personalization >
Display >
(1) "Use these display settings" > "Customize your display"
or
(2) "Set a custom scaling level"
(Terminology was different in earlier Windows versions but I think the features were the same?)
However upon testing these settings with our app neither reproduces the problem.
What else might be causing the text layout issue shown in the image?
This appears to be caused by a Windows bug.
The description & fix as mentioned in the source website are as follows:
if you have a high resolution screen at install time, Win7 will install a larger font set (125%) by default. If you then choose go back to the standard font size (100%), Windows will keep some of the large fonts even though everything else is adjusted for standard fonts, causing programs that use these fonts to break because the text will not always fit inside the GUI.
By editing the Windows registry you can get the original, intended fonts back:
Open the start menu and type regedit and then press Enter.
Locate the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
Find the value MS Sans Serif 8,10,12,14,18,24
Change from SSERIFF.FON to SSERIFE.FON
Find MS Serif 8,10,12,14,18,24
Change from SERIFF.FON to SERIFE.FON
Finally find Courier 10,12,15
Change from COURF.FON to COURE.FON
Restart your system in order for the changes to take effect!
The exact font names may vary depending on locale settings.
I was able to create the problem scenario as described here on Windows 10, and that reproduced the problem with our VB6 app. I think that confirms this as the fix.
A Microsoft blog post seems to be the authoritative original source of this information.

Desktop effects (compiz) turned on: How to capture the image of a window WITH border/frame/title bar?

I would like to get the image of an X server Window (toplevel window, parent is the root Window) with its border/frame/title bar. I have already tried several libraries (Xlib, XRender, gdk, cairo) but none of them works. The captured image has the same geometry as the window but the frame is missing.
The problem is that the child window which should hold the frame image is InputOnly. The reason might be for this that the frame is rendered by the window decorator on the fly the same time as the Window itself.
I cannot capture the image from the RootWindow as the Window might be partially or entirely covered.
Redecorating the captured Window image could be an alternative.
Any suggestions? Thanks.
PS. When compiz is not running everything works as expected.
I use shutter for screen shots on linux, it's super easy to capture whatever portion of the screen you want. As a bonus, there are tools to add arrows or highlight sections.
http://shutter-project.org/preview/screenshots/

Help with application icons

I'm building a program in C++ (target is windows XP) using Visual Studio 2008 and I'm trying to add application icons, the ones that show up in the taskbar, explorer, desktop, etc. My .ico file has the sizes 48x48, 32x32, 24x24, and 16x16 pix in color depths 32-bit, 24-bit, 256 colors, and 16 colors. For what it's worth, I'm adding the .ico file to the binary in IcoFX.
I can get all the icons to show up like they should except for the one in the upper left corner of the program itself--the one that you can click on to bring up a menu with window size options--it still shows the default icon.
To get this little icon to change do I need a different image size or is there a completely different way of managing this one icon? Does that icon even have a specific name?
Thanks for your help.
Duplicated: How do I set the icon for my application in visual studio 2008?
According to one answer on that thread, you need to make sure that your icon is the first icon in the resources file.
Ok, I've figured it out:
I'm using wxWidgets as my GUI toolkit, so this is the only satisfactory answer I can give. wxWidgets has classes to set the main frame icons, those classes include wxIcon and wxIconBundle. Then wxTopLevelWindow::SetIcons can be used to set the application's icons. This sets ALL the icons (taskbar, main frame, alt-tab chooser, etc), no need to mess with a resource file in Visual Studio.

Resources