insightsmop.blogg.se

Python change background mac
Python change background mac










python change background mac python change background mac
  1. #Python change background mac code
  2. #Python change background mac mac
  3. #Python change background mac windows

There might be a bug.\n")ĭef get_config_dir(self, app_name=APP_NAME):Ĭonfighome = os.environĮlif "APPDATA" in os.environ: # On WindowsĬonfighome = BaseDirectory.xdg_config_homeĮxcept ImportError: # Most likely a Linux/Unix system anywayĬonfighome = os.path.join(self.get_home_dir(),".config")Ĭonfigdir = os.path.join(confighome,app_name)

python change background mac python change background mac

("You can try manually to set Your wallpaper to %s" % file_loc) Your desktop environment is not supported.") If first_run: #don't spam the user with the same message over and over again # subprocess.Popen(SCRIPT%file_loc, shell=True) # app('Finder').desktop_t(mactypes.File(file_loc))

#Python change background mac mac

#elif desktop_env="mac": #Not tested since I do not have a mac # (SPI_SETDESKWALLPAPER, 0, file_loc, 0)

#Python change background mac windows

#elif desktop_env="windows": #Not tested since I do not run this on Windows # args = "enlightenment_remote -desktop-bg-add 0 0 0 0 %s" % file_loc On e16 it would have been something in this direction #elif desktop_env="enlightenment": # I have not been able to make it work on e17. # NOT TESTED BELOW - don't want to mess things up # ("Please make sre that You have fbsetbg installed.\n")Īrgs = "pcmanfm -set-wallpaper %s -wallpaper-mode=scaled" % file_loc ("ERROR: Failed to set wallpaper with fbsetbg!\n") # and I have not figured out how else it can be set on Openbox and AfterSTep # now where fbsetbg does the job excellent anyway. # used fbsetbg on jwm too since I am too lazy to edit the XML configuration With codecs.open(desktop_conf_file, "w", encoding="utf-8", errors="replace") as f:Įlif desktop_env in : If desktop_conf.has_option("razor",config_option): #only replacing a valueĭesktop_t("razor",config_option,file_loc) If desktop_env in :Īrgs = Īrgs = 'dcop kdesktop KBackgroundIface setWallpaper 0 "%s" 6' % file_locĪrgs0 = Īrgs1 = Īrgs2 = Įlif desktop_env="razor-qt": #TODO: implement reload of desktop when possibleĭesktop_conf = configparser.ConfigParser()ĭesktop_conf_file = os.path.join(self.get_config_dir("razor"),"nf")Ĭonfig_option = r"screens\1\desktops\1\wallpaper"ĭesktop_conf_file = os.path.join(self.get_home_dir(),".razor/nf")ĭesktop_conf.read(os.path.join(desktop_conf_file)) # I have not been able to set the desktop background fromĭesktop_env = self.get_desktop_environment() # Note: There are two common Linux desktop environments where use the following method in one of my initial projects: def set_wallpaper(self,file_loc, first_run): 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")

#Python change background mac 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.












Python change background mac