4 задача
This commit is contained in:
@@ -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")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 639 KiB |
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user