-
-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tkinter causing unwanted output in most recent macOS #101067
Comments
Were do you see this output? Is it in the terminal window or a popup? The output looks like the stack trace in a crash dump. BTW. I don't get this error on my machine (macOS 13.1 on M1), using installer from python.org. Just to be sure about installation details, what's the output of |
@ronaldoussoren It comes out in the terminal window and I am sure about the Python installation details on my Mac. On the other hand, I think I was able to further isolate the problem. For it to occur, one also needs to have the "Automatically hide and show the menu bar" option set for example at When I execute the following when the above mentioned menu bar option in System Settings is set to
the program works as expected again except the following unwanted output this time:
|
It looks like this is possibly an issue on Apple's end with Ventura specifically as there are many other reports of this same issue happening in other apps. also xref the matplotlib issue where this happens for our native macOS backend and tk/qt, so it isn't tk specific: matplotlib/matplotlib#24997 I don't see any open reports on Apple's end, so perhaps it is worth opening an issue with them to try and fix it further upstream. |
@greglucas wrote #101067 (comment)
Is it possible that Apple has made some changes to certain parts of macOS recently and some of the programs or libraries were not updated as per necessary causing this unwanted output under certain conditions? How would someone know the underlying cause for sure? On another note, how do you follow the open reports on Apple's end? |
I can reproduce the issue with python 3.11.1 using the installer on python.org when "Automaticly hide and show the menu bar" is set to "Always". I can also reproduce the issue using a Cocoa program (which is a bit rough due to being a direct translation of an quick PyObjC program): #import <Cocoa/Cocoa.h>
@interface MainWindowController : NSWindowController <NSWindowDelegate>
{}
@end
@implementation MainWindowController
-(void)windowDidLoad {
[super windowDidLoad];
[[self window] setDelegate: self];
}
-(void)windowWillClose:(id)notif
{
NSLog(@"window closing");
}
@end
@interface AppDelegate : NSObject <NSApplicationDelegate>
{
MainWindowController* windowController;
}
@end
@implementation AppDelegate
-(id)init {
self = [super init];
if (!self) return nil;
NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 100, 100)
styleMask: (
NSWindowStyleMaskClosable
| NSWindowStyleMaskTitled
| NSWindowStyleMaskResizable
| NSWindowStyleMaskMiniaturizable)
backing:NSBackingStoreBuffered
defer:NO];
windowController = [[MainWindowController alloc] initWithWindow:window];
NSButton* button = [NSButton buttonWithTitle:@"Quit" target:nil action:@selector(terminate:)];
[[window contentView] addSubview:button];
return self;
}
-(void)applicationDidFinishLaunching:(id)notif
{
[[windowController window] setDelegate: windowController];
[windowController showWindow:self];
}
@end
int main(int argc, const char** argv)
{
NSApplication* app = [NSApplication sharedApplication];
NSMenu* menubar = [[NSMenu alloc] init];
NSMenuItem* appMenuItem = [[NSMenuItem alloc] init];
[menubar addItem:appMenuItem];
[app setMainMenu:(menubar)];
NSMenu* appMenu = [[NSMenu alloc] init];
[appMenu addItem:[[NSMenuItem alloc] initWithTitle:@"About demo" action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@"A"]];
[appMenu addItem:[NSMenuItem separatorItem]];
[appMenu addItem:[[NSMenuItem alloc] initWithTitle:@"Quit demo" action:@selector(terminate:) keyEquivalent:@"q"]];
[appMenuItem setSubmenu:appMenu];
AppDelegate* delegate = [[AppDelegate alloc] init];
[app setDelegate:delegate];
NSApplicationMain(argc, argv);
} $ mkdir -p demo.app/Contents/MacOS
$ cc -o demo.app/Contents/MacOS/demo demo.m -framework Cocoa
$ ./demo.app/Contents/MacOS/demo This also works correctly but prints a stack trace. Running the binary outside of an app bundle doesn't print the stack trace. I've filed an Feedback Assistant report about this with Apple: FB11952660. Closing the issue because this is an operating system bug, and not something we can fix on our end. |
Bug report
Tkinter seems to be causing unwanted output when executed under the most recent versions of macOS with the "Automatically hide and show the menu bar" option set at
Always
under Systems Settings->Desktop&Dock->Menu Bar. For example, when I run the following simple program:through the macOS command line interface with (assume the filename is
test.py
):I get the following output through the command line interface in addition to the graphic with
Hello, world!
in a separate window as expected:Other than this unwanted output, however, everything seems to work fine.
Your environment
This issue might have started after I upgraded macOS from 12.6.1 to 13.1 recently.
I have installed Python 3.11.1 and run the small program using it after starting to have this problem but the unwanted output issue with Tkinter did not get resolved. I have installed both versions of Python using the 64-bit universal installer from python.org.
The text was updated successfully, but these errors were encountered: