From 13271860993cedc1fd3ac362dc110f708d98c5da Mon Sep 17 00:00:00 2001 From: Dmitrium12 Date: Mon, 30 Jan 2023 19:04:03 +0700 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=88=D0=B8=D0=BB=203=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B4=D0=B0=D1=87=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/get_img_map.py | 4 ++-- main.py | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/functions/get_img_map.py b/functions/get_img_map.py index 3f50e41..fb7d509 100644 --- a/functions/get_img_map.py +++ b/functions/get_img_map.py @@ -9,9 +9,9 @@ lon = "37.530887" lat = "55.703118" -def get_img_map(delta): +def get_img_map(delta, cords): params = { - "ll": ",".join([lon, lat]), + "ll": ",".join([str(cords[0]), str(cords[1])]), "spn": ",".join([str(delta), str(delta)]), "l": "map" } diff --git a/main.py b/main.py index 98bcce8..5b5befe 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,9 @@ class Window(QMainWindow): self.setGeometry(0, 0, 600, 450) self.label = QLabel(self) self.delta = 0.02 - get_img_map(self.delta) + self.lon = 37.530887 + self.lat = 55.703118 + get_img_map(self.delta, (self.lon, self.lat)) self.pixmap = QPixmap('image.png') self.label.setPixmap(self.pixmap) self.label.resize(self.pixmap.width(), self.pixmap.height()) @@ -21,18 +23,30 @@ class Window(QMainWindow): def keyPressEvent(self, event): try: - if event.key() == QtCore.Qt.Key_Up: + if event.key() == QtCore.Qt.Key_PageUp: self.delta += 0.01 self.update() - if event.key() == QtCore.Qt.Key_Down: + if event.key() == QtCore.Qt.Key_PageDown: self.delta -= 0.01 self.update() + if event.key() == QtCore.Qt.Key_W: + self.lat += 0.01 + self.update() + if event.key() == QtCore.Qt.Key_S: + self.lat -= 0.01 + self.update() + if event.key() == QtCore.Qt.Key_A: + self.lon -= 0.01 + self.update() + if event.key() == QtCore.Qt.Key_D: + self.lon += 0.01 + self.update() event.accept() except Exception as e: print(e) def update(self): - get_img_map(self.delta) + get_img_map(self.delta, (self.lon, self.lat)) self.pixmap = QPixmap('image.png') self.label.setPixmap(self.pixmap) self.label.resize(self.pixmap.width(), self.pixmap.height())