def __init__(self, parent): tkinter.Frame.__init__(self, parent, background=styling.background_color, padx=10, pady=15) self.parent = parent self.image_path = helpers.get_images_dir_path() self.image_obj = tkinter.PhotoImage(file=self.image_path + 'bullet_green_small.gif') self.no_image_obj = tkinter.PhotoImage(file=self.image_path + 'no_image.gif') self.setup()
def config_logo(self): if constants.display_images: # This works to add icon to all windows from disappeer.utilities import helpers image_path = helpers.get_images_dir_path() img = tkinter.PhotoImage(file=image_path + 'logo_icon.png') self.root.tk.call('wm', 'iconphoto', self.root._w, '-default', img)
def __init__(self, parent): tkinter.Frame.__init__(self, parent, background=styling.background_color, padx=10, pady=15) self.parent = parent self.image_path = helpers.get_images_dir_path() self.setup()
def config_form_elements(self): """ For each item in key info ordered fields list, create label and entry. Label is from ordered field list. Entry is corresponding val from self.key_dict. """ elements_frame = tkinter.Frame(self.main_frame, **styling.alert_box_elements_frame) elements_frame.grid(row=0, column=0, sticky=styling.sticky_all, pady=(0, 10)) elements_frame.columnconfigure(0, weight=1) elements_frame.rowconfigure(0, weight=1) elements_frame.rowconfigure(1, weight=1) elements_frame.rowconfigure(2, weight=1) elements_frame.rowconfigure(3, weight=1) elements_frame.rowconfigure(4, weight=1) if constants.display_images: image_path = helpers.get_images_dir_path() logo_path = image_path + "logo_64x64.gif" image = tkinter.PhotoImage(file=logo_path) label = tkinter.Label(elements_frame, image=image, background=styling.background_color) label.photo = image label.grid(row=0, column=0, sticky=styling.sticky_all) name = tkinter.Label(elements_frame, text=metainfo.title + " " + metainfo.version, **styling.label_args) name.grid(row=1, column=0, sticky=styling.sticky_all, ipady=1) gpl = tkinter.Label(elements_frame, text="License: " + metainfo.license, **styling.label_args) gpl.grid(row=2, column=0, sticky=styling.sticky_all, ipady=1) github = tkinter.Label(elements_frame, text="Source: " + metainfo.github, **styling.label_args) github.grid(row=3, column=0, sticky=styling.sticky_all, ipady=1) email = tkinter.Label(elements_frame, text="Contact: " + metainfo.email, **styling.label_args) email.grid(row=4, column=0, sticky=styling.sticky_all, ipady=1)
def test_get_images_dir_path(self): from disappeer import images expected = os.path.dirname(images.__file__) + '/' actual = helpers.get_images_dir_path() self.assertEqual(expected, actual)