diff --git a/functions/get_img_map.py b/functions/get_img_map.py index 16ef419..14de117 100644 --- a/functions/get_img_map.py +++ b/functions/get_img_map.py @@ -18,5 +18,6 @@ def get_img_map(delta: float, cords: tuple, variant_map: str) -> None: "l": variant_map } response = requests.get("http://static-maps.yandex.ru/1.x/", params=params) + # print(response.text) Image.open(BytesIO( response.content)).save("image.png") diff --git a/image.png b/image.png index c2724ad..68a54ea 100644 Binary files a/image.png and b/image.png differ diff --git a/main.py b/main.py index b889ed8..b95dc2e 100644 --- a/main.py +++ b/main.py @@ -1,26 +1,28 @@ from PyQt5.QtWidgets import * from PyQt5.QtGui import QPixmap import sys +from PyQt5 import uic from PyQt5 import QtCore from functions.get_img_map import get_img_map class Window(QMainWindow): def __init__(self): - super().__init__() + super().__init__(None) + uic.loadUi('window.ui', self) + self.pixmap = None self.acceptDrops() self.setWindowTitle("Image") - self.setGeometry(0, 0, 600, 450) - self.label = QLabel(self) self.delta = 0.02 self.lon = 37.530887 self.lat = 55.703118 self.variant_map = "map" - get_img_map(self.delta, (self.lon, self.lat), self.variant_map) - self.pixmap = QPixmap('image.png') - self.label.setPixmap(self.pixmap) - self.label.resize(self.pixmap.width(), self.pixmap.height()) - self.show() + self.update() + self.button_group = QButtonGroup() + self.button_group.addButton(self.map) + self.button_group.addButton(self.sat) + self.button_group.addButton(self.skl) + self.button_group.buttonClicked.connect(self.push_button) def keyPressEvent(self, event): try: @@ -53,6 +55,13 @@ class Window(QMainWindow): self.label.resize(self.pixmap.width(), self.pixmap.height()) self.show() + def push_button(self, button): + if button.text() == "skl": + self.variant_map = "sat,skl" + else: + self.variant_map = button.text() + self.update() + App = QApplication(sys.argv) window = Window()