Example #1
0
 def filter_picture():
     if pm == None:
         the_message_textbox.add("Error: Must load picture first")
     elif the_filter_entry.get() == "":
         the_message_textbox.add("Error: Must specify valid filter first")
     else:
         f = eval(the_filter_entry.get())
         pm.filter(f)
         display_image("Picture", pm.image)
         the_filter_entry.config(bg="green")
Example #2
0
 def filter_picture():
     if pm == None:
         the_message_textbox.add("Error: Must load picture first")
     elif the_filter_entry.get() == "":
         the_message_textbox.add("Error: Must specify valid filter first")
     else:
         f = eval(the_filter_entry.get())
         pm.filter(f)
         display_image("Picture", pm.image)
         the_filter_entry.config(bg="green")
Example #3
0
 def load_picture():
     try:
         global pm
         if the_photomosaic_option.get() == "Choose Photomosaic Class":
             the_message_textbox.add("Error: Must specify Photomosaic option first")
         elif the_photomosaic_entry.get() == "":
             the_message_textbox.add("Error: Must specify Photomosaic file first")
         else:
             pm = eval(the_photomosaic_option.get())(the_photomosaic_entry.get())
             the_photomosaic_entry.config(bg="green")
             display_image("Picture", pm.image)
             the_message_textbox.add("Photomosaic file read")
     except:
         the_message_textbox.add("Photomosaic file unknown")
Example #4
0
 def load_picture():
     try:
         global pm
         if the_photomosaic_option.get() == "Choose Photomosaic Class":
             the_message_textbox.add(
                 "Error: Must specify Photomosaic option first")
         elif the_photomosaic_entry.get() == "":
             the_message_textbox.add(
                 "Error: Must specify Photomosaic file first")
         else:
             pm = eval(the_photomosaic_option.get())(
                 the_photomosaic_entry.get())
             the_photomosaic_entry.config(bg="green")
             display_image("Picture", pm.image)
             the_message_textbox.add("Photomosaic file read")
     except:
         the_message_textbox.add("Photomosaic file unknown")
Example #5
0
 def display(self):
     def compose_images(picture_list,xs,ys):
         result = Image.new("RGB",(self.size[0]*xs,self.size[1]*ys))
         i = 0
         for y in range(ys):
             for x in range(xs):
                 if i >= len(picture_list):
                     return result
                 result.paste(picture_list[i].image,(x*self.size[0],y*self.size[1]))
                 i += 1
         return result
 
     xs = round(math.sqrt(self.size[1]/self.size[0] * len(self.tiles)))
     ys = round(math.sqrt(self.size[0]/self.size[1] * len(self.tiles)))
     while xs*ys < len(self.tiles):
         ys += 1
     result = compose_images(self.tiles,xs,ys)
     display_image("Database",result)