diff options
-rw-r--r-- | foo | 3 | ||||
-rwxr-xr-x | logout-manager-tcl.py | 8 |
2 files changed, 9 insertions, 2 deletions
@@ -0,0 +1,3 @@ +if LM_USE_SVG == 1, line 256 +also +try: form cairosvg import svg2png diff --git a/logout-manager-tcl.py b/logout-manager-tcl.py index 4d823d5..cc3b2fb 100755 --- a/logout-manager-tcl.py +++ b/logout-manager-tcl.py @@ -39,7 +39,7 @@ import lmlib LM_USE_SVG = 0 try: - from cairosvgf import svg2png + from cairosvg import svg2png LM_USE_SVG = 1 except: print("WARNING: Unable to import cairosvg. No svg images will be displayed.") @@ -274,6 +274,10 @@ def photoimage_from_svg(filename = "",size = "48"): item = svg2png(url=filename, parent_width = size, parent_height = size) return ImageTk.PhotoImage(data=item) +def empty_photoimage(size=24): + photo = Image.new("RGBA",[size,size]) + return ImageTk.PhotoImage(image=photo) + def image_from_svg(filename = "",size = "48"): # open svg if LM_USE_SVG == 1: @@ -311,7 +315,7 @@ def get_scaled_icon(icon_name, size = 24, icon_theme = "default", fallback_icon_ except Exception as f: print("Error with icon file.") print(f) - return None + return empty_photoimage() photo.thumbnail(size=[size, size]) try: photo = ImageTk.PhotoImage(photo) |