def canvas_frame_test(): cf = CanvasFrame(None, autofit=True) cf.set_imgs([camera(), 255 - camera()]) cf.Show()
se = self.oldp + (y, x) rs, cs = line(*[int(i) for i in se]) rs.clip(0, ips.shape[1], out=rs) cs.clip(0, ips.shape[0], out=cs) ips.img[rs, cs] = 255 self.oldp = (y, x) key['canvas'].update() def mouse_wheel(self, ips, x, y, d, **key): pass if __name__ == '__main__': from skimage.data import camera, astronaut from skimage.io import imread app = wx.App() cf = CanvasFrame(None, autofit=False) cf.set_imgs([camera(), 255 - camera()]) cf.set_cn(0) bar = cf.add_menubar() bar.load(('menu', [ ('Filter', [('Gaussian', Gaussian), ('Unto', Undo)]), ])) bar = cf.add_toolbar() bar.add_tool(DefaultTool, 'M') bar.add_tool(Pencil, 'P') cf.Show() app.MainLoop()