Skip to content

Commit e6a04d8

Browse files
Adapted GUI layout
1 parent 84d6120 commit e6a04d8

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

assets/astrolens.png

-66.5 KB
Loading

spectrometer/CCDpanelsetup.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,35 @@ def aboutbutton(self, about_row):
960960
)
961961
self.bhelp.pack(side=tk.RIGHT, expand=True, fill=tk.X, padx=(2, 0))
962962

963+
# Add AstroLens logo below the buttons
964+
try:
965+
from PIL import Image, ImageTk
966+
import os
967+
968+
# Get the path to the PNG file
969+
logo_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "assets", "astrolens.png")
970+
971+
if os.path.exists(logo_path):
972+
logo_image = Image.open(logo_path)
973+
974+
# Calculate proper aspect ratio resize
975+
# Original SVG is 645.31 x 172.4 (aspect ratio ~3.74:1)
976+
target_width = 350 # Adjust this to your preferred width
977+
aspect_ratio = logo_image.width / logo_image.height
978+
target_height = int(target_width / aspect_ratio)
979+
980+
logo_image = logo_image.resize((target_width, target_height), Image.Resampling.LANCZOS)
981+
logo_photo = ImageTk.PhotoImage(logo_image)
982+
983+
self.logo_label = ttk.Label(self, image=logo_photo)
984+
self.logo_label.image = logo_photo # Keep a reference
985+
self.logo_label.grid(row=about_row + 1, columnspan=3, pady=(40, 5), padx=(7,0))
986+
except Exception as e:
987+
print(f"Could not load logo: {e}")
988+
963989
def open_help_url(self):
964990
"""Open the help URL in the default browser"""
965991
try:
966992
webbrowser.open("https://www.astrolens.net/pyspec-help")
967993
except Exception as e:
968-
print(f"Failed to open browser: {e}")
994+
print(f"Failed to open browser: {e}")

0 commit comments

Comments
 (0)