From 34c0b91228a1ed087556f9691807bcc014e0917c Mon Sep 17 00:00:00 2001 From: Huy Pham <42948410+hpham@users.noreply.github.com> Date: Mon, 16 Dec 2019 12:04:18 -0800 Subject: [PATCH] update zoom % on statusbar --- coretk/coretk/graph/graph.py | 2 ++ coretk/coretk/statusbar.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/coretk/coretk/graph/graph.py b/coretk/coretk/graph/graph.py index a2d82dc4..e8fd6cff 100644 --- a/coretk/coretk/graph/graph.py +++ b/coretk/coretk/graph/graph.py @@ -464,6 +464,8 @@ class CanvasGraph(tk.Canvas): ) logging.info("ratio: %s", self.ratio) logging.info("offset: %s", self.offset) + self.app.statusbar.zoom.config(text="%s" % (int(self.ratio * 100)) + "%") + if self.wallpaper: self.redraw_wallpaper() diff --git a/coretk/coretk/statusbar.py b/coretk/coretk/statusbar.py index 0528bbf2..5ed6f09d 100644 --- a/coretk/coretk/statusbar.py +++ b/coretk/coretk/statusbar.py @@ -46,7 +46,11 @@ class StatusBar(ttk.Frame): self.status.grid(row=0, column=1, sticky="ew") self.zoom = ttk.Label( - self, text="ZOOM TBD", anchor=tk.CENTER, borderwidth=1, relief=tk.RIDGE + self, + text="%s" % (int(self.app.canvas.ratio * 100)) + "%", + anchor=tk.CENTER, + borderwidth=1, + relief=tk.RIDGE, ) self.zoom.grid(row=0, column=2, sticky="ew")