Beispiel #1
0
    def __init__(self, parent, event_name=""):
        selected_off = var.selected_off
        background_color = var.background_color
        font_style = var.font_style
        font_sizes = var.font_sizes
        Frame.__init__(self, parent, bg=background_color)

        # Initializing Boolean color for all labels
        self.color_all = selected_off

        # Creating the regular icon photo an tinted photo
        self.image = Image.open("assets/newspaper.png")
        self.image = self.image.resize(var.font_sizes['small_icon'], Image.ANTIALIAS)
        self.image = self.image.convert('RGB')
        self.icon_photo, self.icon_photo_tinted = None, None
        self.icon_photo = ImageTk.PhotoImage(self.image)
        self.icon_photo_tinted = ImageTk.PhotoImage(imagecolor.tint(self.image,var.selected_on))

        # Initializing Labels
        self.icon_label = Label(self, bg=background_color, image=self.icon_photo)
        self.icon_label.image = self.icon_photo
        self.icon_label.pack(side=LEFT, anchor=N)

        self.event_name = event_name[:var.font_sizes['news_length']]
        if len(event_name) > var.font_sizes['news_length']:
            self.event_name += '...'
        self.event_name_label = Label(self, text=self.event_name, font=(font_style,  font_sizes['text']), fg=selected_off,
                                      bg=background_color)
        self.event_name_label.pack(side=LEFT, anchor=N)
Beispiel #2
0
 def create_photo(self):
     self.image = self.image.resize(var.font_sizes['small_icon'],
                                    Image.ANTIALIAS)
     self.image = self.image.convert('RGB')
     self.icon_photo = ImageTk.PhotoImage(self.image)
     self.icon_photo_selected = ImageTk.PhotoImage(
         imagecolor.tint(self.image, var.selected_on))
     self.icon_label.config(image=self.icon_photo)
Beispiel #3
0
    def change_font_size(self):
        # Updating image
        self.image = self.image.resize(var.font_sizes['small_icon'], Image.ANTIALIAS)
        self.image = self.image.convert('RGB')
        self.icon_photo, self.icon_photo_tinted = None, None
        self.icon_photo = ImageTk.PhotoImage(self.image)
        self.icon_photo_tinted = ImageTk.PhotoImage(imagecolor.tint(self.image, var.selected_on))

        self.event_name_label.config(font=(var.font_style,  var.font_sizes['text']))
Beispiel #4
0
    def create_box_images(self):
        image = Image.open("assets/empty_check_box.png")
        image = image.resize(var.font_sizes['small_icon'], Image.ANTIALIAS)
        image = image.convert('RGB')
        self.plain_empty_checked_box = image
        self.unchecked_photo = ImageTk.PhotoImage(image)

        # Checked off and yellow
        image = imagecolor.tint(image, var.selected_on)
        self.unchecked_photo_selected = ImageTk.PhotoImage(image)

        # Not Checked off and white
        image = Image.open("assets/check_box.png")
        image = image.resize(var.font_sizes['small_icon'], Image.ANTIALIAS)
        image = image.convert('RGB')
        self.plain_checked_box = image
        self.checked_photo = ImageTk.PhotoImage(image)

        # Not Checked off and yellow
        image = imagecolor.tint(image, var.selected_on)
        self.checked_photo_selected = ImageTk.PhotoImage(image)
Beispiel #5
0
 def update_colored_boxes(self):
     self.unchecked_photo_selected = ImageTk.PhotoImage(
         imagecolor.tint(self.plain_empty_checked_box, var.selected_on))
     self.checked_photo_selected = ImageTk.PhotoImage(imagecolor.tint(self.plain_checked_box, var.selected_on))