Beispiel #1
0
 def zoom_out(self, event):
     print('zoom out')
     xshift, yshift = event.x - self.canvas.image.width() // 2, self.canvas.image.height() // 2 - event.y
     self.fsize *= 4.0
     self.cx, self.cy =  xshift * self.step + self.cx, yshift * self.step + self.cy
     self.image_file = mandel_file(self.cx, self.cy, self.fsize, self.max_iterations)
     self.canvas.image = self.load_image()
Beispiel #2
0
    def __init__(self, width=640, height=480, image_file=main_file):
        tk.Tk.__init__(self)
        self.canvas = tk.Canvas(width=width, height=height)
        self.geometry("%sx%s+100+100" % (width, height + 40))
        self.canvas.pack()
        self.item = None

        self.label = tk.Label(self.canvas, font=('courier', 10))
        self.parameters_from_fn(image_file)
        if not os.path.isfile(image_file):
            self.image_file = mandel_file(self.cx, self.cy, self.fsize,
                                          self.max_iterations)
            print('Mainfile %s generated' % self.image_file)
        else:
            self.image_file = image_file
        self.label.pack(side=tk.BOTTOM)

        self.canvas.image = self.load_image()
        self.x, self.y, self.size = None, None, (0, )
        self.bind("<Button-2>", self.recalculate)
        # Linux
        self.bind("<Button-1>", self.zoom_in)
        self.bind("<Button-3>", self.zoom_out)
        # Windows
        self.bind("<MouseWheel>", self.mouse_wheel)
Beispiel #3
0
 def zoom_out(self, event):
     print('zoom out')
     xshift, yshift = event.x - self.canvas.image.width() // 2, self.canvas.image.height() // 2 - event.y
     self.fsize *= 4.0
     self.cx, self.cy =  xshift * self.step + self.cx, yshift * self.step + self.cy
     self.image_file = mandel_file(self.cx, self.cy, self.fsize, self.max_iterations)
     self.canvas.image = self.load_image()
Beispiel #4
0
    def __init__(self, width=640, height=480, image_file=main_file):
        tk.Tk.__init__(self)
        self.canvas = tk.Canvas(width=width, height=height)
        self.geometry("%sx%s+100+100" % (width,height+40))
        self.canvas.pack()
        self.item = None
        
        self.label = tk.Label(self.canvas, font=('courier', 10))
        self.parameters_from_fn(image_file)
        if not os.path.isfile(image_file):
            self.image_file = mandel_file(self.cx, self.cy, self.fsize, self.max_iterations)
            print('Mainfile %s generated' % self.image_file)
        else:
            self.image_file = image_file           
        self.label.pack(side=tk.BOTTOM)

        self.canvas.image = self.load_image()
        self.x, self.y, self.size = None, None, (0,)
        self.bind("<Button-2>", self.recalculate)
        # Linux
        self.bind("<Button-1>", self.zoom_in)
        self.bind("<Button-3>", self.zoom_out)
        # Windows
        self.bind("<MouseWheel>", self.mouse_wheel)
Beispiel #5
0
 def recalculate(self, event):
     print('recalculating')
     self.image_file = mandel_file(self.cx, self.cy, self.fsize, self.max_iterations)
     self.canvas.image = self.load_image()
     self.update_label()
Beispiel #6
0
 def recalculate(self, event):
     print('recalculating')
     self.image_file = mandel_file(self.cx, self.cy, self.fsize,
                                   self.max_iterations)
     self.canvas.image = self.load_image()
     self.update_label()