Tkinter Show splash screen and hide main screen until __init__ has finished

a simple example for python3: #!python3 import tkinter as tk import time class Splash(tk.Toplevel): def __init__(self, parent): tk.Toplevel.__init__(self, parent) self.title(“Splash”) ## required to make window show before the program gets to the mainloop self.update() class App(tk.Tk): def __init__(self): tk.Tk.__init__(self) self.withdraw() splash = Splash(self) ## setup stuff goes here self.title(“Main Window”) ## simulate a delay while … Read more

Tkinter ttk see custom theme settings

Offical list of all options by ttk finally found a list that includes all coloration options to style with ttk. https://wiki.tcl-lang.org/page/Changing+Widget+Colors ttk.Button ttk::style configure TButton -background color ttk::style configure TButton -foreground color ttk::style configure TButton -font namedfont ttk::style configure TButton -focuscolor color ttk::style map TButton -background \ [list active color disabled color readonly color] ttk::style … Read more

How do I include files with pyinstaller?

Sorry, I thought that only -F/–one-file makes such behavior, but looks like any bundling with pyinstaller needs such changes. You need to change your code like this, as explained in this answer: import sys if getattr(sys, ‘frozen’, False): image = PhotoImage(file=os.path.join(sys._MEIPASS, “files/bg.png”)) else: image = PhotoImage(file=”files/bg.png”) And then bundle it with pyinstaller like this: pyinstaller … Read more

TclError: no display name and no $DISPLAY environment variable in Google Colab

I found it from another post on Reddit that you could create a virtual display. The below actually worked on my Colab notebook. ### CREATE VIRTUAL DISPLAY ### !apt-get install -y xvfb # Install X Virtual Frame Buffer import os os.system(‘Xvfb :1 -screen 0 1600x1200x16 &’) # create virtual display with size 1600×1200 and 16 … Read more