jiloupdates.blogg.se

Nothing changes if nothing changes mac background
Nothing changes if nothing changes mac background







nothing changes if nothing changes mac background
  1. Nothing changes if nothing changes mac background full#
  2. Nothing changes if nothing changes mac background code#
  3. Nothing changes if nothing changes mac background windows#

Tkinter.Button wasn't working on MacOS, and Tkmacosx.Button had undesirable behaviors.

Nothing changes if nothing changes mac background windows#

However, it must work in both MacOS and Windows (or at least find a solution for each respectively).

nothing changes if nothing changes mac background

Problem: I want to create a button from an image. I am building an application where the GUI is compatible with both MacOS and Windows OS.

nothing changes if nothing changes mac background

But for someone trying to work around the macOS color issue, just using a TTButton in lieu of a Tkinter Button suffices.Ī I had a similar problem.

Nothing changes if nothing changes mac background full#

You can use it as follows: from ttwidgets import TTButtonĪ TTButton supports the full interface of a Tkinter Button but with many enhancements. I just tested it on macOS Sierra, and it works around the Button bg/fg color problem. And because of the underlying Labels rather than Buttons, it works around the issue on macOS. Those different colors and fonts are created by passing in HTML-like tagged text in lieu of regular text. Essentially the project creates a compound Button or Label consisting of multiple underlying Label widgets (each with its own color/font) but acting like a single object.

nothing changes if nothing changes mac background

I wrote the project to allow multi-font, multi-color Buttons and Labels. I wrote a project called Tagged Text Widgets ('ttwidgets' on ) which essentially does just that. You'd miss out on some of the "animation" of button press and release, but you'd get your background and foreground colors as desired. You can always make your own Button class which is wrapped around a Label with a border (default width is 2) and a bind call for the Button Release. (text=text,bg=bg,width=width,height=height,fg=fg,font=font,highlightbackground=bordercolor,highlightthickness=bordersize)īutton and Label seem pretty similar to me, so I find it odd that the Label and Button work differently. Self.button_nfigure(width=width,height=height,bg=bg) Self.button_ace(anchor=anchor,relx=relx,rely=rely)ĭef configure(self,width=width,height=height,text=text,bg=bg,fg=fg,font=font,command=command,bordercolor=bordercolor,bordersize=bordersize): Self.label = tk.Label(self.button_frame,text=self.text,bg=self.bg,width=self.width,height=self.height,fg=self.fg,font=self.font,highlightbackground=self.bordercolor,highlightthickness=self.bordersize) Self.button_frame = tk.Frame(root,width=width,height=height,bg=bg) import tkinter as tkĭef _init_(self,root,width=100,height=20,text="",bg="white",fg="black",font="f 12",command=None,bordercolor="black",bordersize=0): Not sure if anyone is still viewing this thread, but I have created a simple solution to this problem by creating my own Button class. If platform.system() = "Darwin": # if its a Macī = Button(text="Refersh All Windows", highlightbackground="Yellow", fg="Black", highlightthickness=30)ī = Button(text="Refresh All Windows", bg="Yellow", fg="Black")

Nothing changes if nothing changes mac background code#

If you want your code to be OS independent, you can either add an 'if OS = "Mac"' statement or even add a custom function that modifies the button if its on a Mac but leaves it alone on Windows or Linux. This will be the button with the 'command' on it or the button you bind events to. Next use place to parent a background color button on top of it. However, if you must use grid, you can always hack it.create your colorless grid button. With grid, increasing the border size increases the button size automatically, unfortunately. This works if you are using place, but not if you are using something like grid. This will give your button the appearance of a label. If you increase the size of the border to be huge (the size of the button or greater), you will get a nice, solid background color. Its quite annoying that after years this is still a problem.Īnyways, as others have mentioned, highlightbackground (the border color) can be used in place of background on a Mac.









Nothing changes if nothing changes mac background