Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # --- other.py ---
- import tkinter as tk
- import os
- HOME = os.path.dirname(os.path.abspath(sys.argv[0]))
- def load_images():
- return {
- 'blanc': tk.PhotoImage(file=os.path.join(HOME, "blanc.gif")),
- #'blanc': tk.PhotoImage(file=os.path.join(HOME, "images", "blanc.gif")),
- }
- # --- main.py ---
- import tkinter as tk
- import other
- #images = other.load_images() #Too early to create image
- root = tk.Tk()
- images = load_images() # OK
- l = tk.Label(root, image=images['blanc'])
- l.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement