Skip to content

Commit

Permalink
Fix splash screen when multiple TK windows are open
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpalms committed Sep 12, 2023
1 parent 75cf0c5 commit b182ccc
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions diambra/arena/utils/splash_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

gif_file_path = os.path.join(os.path.dirname(__file__), ".splash_screen.gif")


def get_monitor_from_coord(x, y):
monitors = screeninfo.get_monitors()

Expand All @@ -13,12 +12,8 @@ def get_monitor_from_coord(x, y):
return m
return monitors[0]

# Class to manage gampad


class SplashScreen():
def __init__(self, time_interval=100, timeout=5000):

self.timeout = timeout
self.time_interval = time_interval
# self.labels = (t*"\u25AE" for t in range(int((timeout-750)/time_interval)))
Expand All @@ -30,14 +25,13 @@ def __init__(self, time_interval=100, timeout=5000):
self.window.wm_attributes("-topmost", True)

# Get the screen which contains top
current_screen = get_monitor_from_coord(
self.window.winfo_x(), self.window.winfo_y())
current_screen = get_monitor_from_coord(self.window.winfo_x(), self.window.winfo_y())

# Get the monitor's size
width = current_screen.width
height = current_screen.height

image = tk.PhotoImage(file=gif_file_path)
image = tk.PhotoImage(master=self.window, file=gif_file_path)
hw_dim = [image.height(), image.width()]
self.window.geometry(
'%dx%d+%d+%d' % (hw_dim[1], hw_dim[0],
Expand Down

0 comments on commit b182ccc

Please sign in to comment.