4 задача

This commit is contained in:
2023-01-30 19:34:51 +07:00
parent b95d3e4680
commit 94480dcd0c
3 changed files with 18 additions and 8 deletions
+1
View File
@@ -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")
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 639 KiB

+17 -8
View File
@@ -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()