コード例 #1
0
ファイル: mandelbrot2_main.py プロジェクト: GINK03/shedskin
 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()
コード例 #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)
コード例 #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()
コード例 #4
0
ファイル: mandelbrot2_main.py プロジェクト: GINK03/shedskin
    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)
コード例 #5
0
ファイル: mandelbrot2_main.py プロジェクト: GINK03/shedskin
 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()
コード例 #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()