Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dummy-monitor-splash #91

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion diambra/arena/utils/splash_screen.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import os
import tkinter as tk
import screeninfo
from screeninfo.common import ScreenInfoError, Monitor


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

def get_monitor_from_coord(x, y):
monitors = screeninfo.get_monitors()
try:
monitors = screeninfo.get_monitors()
if not monitors:
raise ScreenInfoError("No enumerators available")
except ScreenInfoError:
# Fallback to a dummy monitor if no monitors are available
width = 1024
height = 768
width_mm = 361
height_mm = 203
return Monitor(0, 0, width, height, width_mm, height_mm)

for m in reversed(monitors):
if m.x <= x <= m.width + m.x and m.y <= y <= m.height + m.y:
Expand Down