From fc50782116c4c0dac2583dde0f43f21679b95f34 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Mon, 20 Dec 2021 23:14:27 +0100 Subject: [PATCH] Print position in status bar --- painter.py | 6 ++++++ status_bar.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/painter.py b/painter.py index 1a28ebc..c841cbd 100644 --- a/painter.py +++ b/painter.py @@ -203,6 +203,9 @@ class Painter(Widget): self.draw() + # draw status bar + self.app.status_bar.draw() + # respond to drag def on_touch_move(self,touch): @@ -218,6 +221,9 @@ class Painter(Widget): # redraw self.draw() + # draw status bar + self.app.status_bar.draw() + # find the particle at position pos def find_particle(self,pos): diff --git a/status_bar.py b/status_bar.py index ee42a14..111ac76 100644 --- a/status_bar.py +++ b/status_bar.py @@ -39,5 +39,12 @@ class Status_bar(Label): if self.app.readonly: self.raw_text+=" [RO]" + # coordinates of selected cross + if len(self.app.painter.selected)>0: + # number of spaces to align right (use 13 characters to print position) + spaces=int(self.width/self.char_width)-len(self.raw_text)-13 + if spaces>0: + self.raw_text+=" "*spaces+"({:05.2f},{:05.2f})\n".format(self.app.painter.selected[0].squares[0].pos.x,self.app.painter.selected[0].squares[0].pos.y) + # do not wrap self.text=self.raw_text[:min(len(self.raw_text),int(self.width/self.char_width))]