Changes the icon that is shown on the title bar and on the task bar. NOTE - The file type is IMPORTANT and depends on the OS! Can pass in: * filename which must be a .ICO icon file for windows, PNG file for Linux * bytes object * BASE64 encoded file h
(self, icon=None, pngbase64=None)
| 10438 | |
| 10439 | # ------------------------- SetIcon - set the window's fav icon ------------------------- # |
| 10440 | def set_icon(self, icon=None, pngbase64=None): |
| 10441 | """ |
| 10442 | Changes the icon that is shown on the title bar and on the task bar. |
| 10443 | NOTE - The file type is IMPORTANT and depends on the OS! |
| 10444 | Can pass in: |
| 10445 | * filename which must be a .ICO icon file for windows, PNG file for Linux |
| 10446 | * bytes object |
| 10447 | * BASE64 encoded file held in a variable |
| 10448 | |
| 10449 | :param icon: Filename or bytes object |
| 10450 | :type icon: (str) |
| 10451 | :param pngbase64: Base64 encoded image |
| 10452 | :type pngbase64: (bytes) |
| 10453 | """ |
| 10454 | if type(icon) is bytes or pngbase64 is not None: |
| 10455 | wicon = tkinter.PhotoImage(data=icon if icon is not None else pngbase64) |
| 10456 | try: |
| 10457 | self.TKroot.tk.call('wm', 'iconphoto', self.TKroot._w, wicon) |
| 10458 | except: |
| 10459 | wicon = tkinter.PhotoImage(data=DEFAULT_BASE64_ICON) |
| 10460 | try: |
| 10461 | self.TKroot.tk.call('wm', 'iconphoto', self.TKroot._w, wicon) |
| 10462 | except: |
| 10463 | pass |
| 10464 | self.WindowIcon = wicon |
| 10465 | return |
| 10466 | |
| 10467 | wicon = icon |
| 10468 | try: |
| 10469 | self.TKroot.iconbitmap(icon) |
| 10470 | except: |
| 10471 | try: |
| 10472 | wicon = tkinter.PhotoImage(file=icon) |
| 10473 | self.TKroot.tk.call('wm', 'iconphoto', self.TKroot._w, wicon) |
| 10474 | except: |
| 10475 | try: |
| 10476 | wicon = tkinter.PhotoImage(data=DEFAULT_BASE64_ICON) |
| 10477 | try: |
| 10478 | self.TKroot.tk.call('wm', 'iconphoto', self.TKroot._w, wicon) |
| 10479 | except: |
| 10480 | pass |
| 10481 | except: |
| 10482 | pass |
| 10483 | self.WindowIcon = wicon |
| 10484 | |
| 10485 | def _GetElementAtLocation(self, location): |
| 10486 | """ |