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
|
"l": variant_map
|
||||||
}
|
}
|
||||||
response = requests.get("http://static-maps.yandex.ru/1.x/", params=params)
|
response = requests.get("http://static-maps.yandex.ru/1.x/", params=params)
|
||||||
|
# print(response.text)
|
||||||
Image.open(BytesIO(
|
Image.open(BytesIO(
|
||||||
response.content)).save("image.png")
|
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.QtWidgets import *
|
||||||
from PyQt5.QtGui import QPixmap
|
from PyQt5.QtGui import QPixmap
|
||||||
import sys
|
import sys
|
||||||
|
from PyQt5 import uic
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
from functions.get_img_map import get_img_map
|
from functions.get_img_map import get_img_map
|
||||||
|
|
||||||
|
|
||||||
class Window(QMainWindow):
|
class Window(QMainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__(None)
|
||||||
|
uic.loadUi('window.ui', self)
|
||||||
|
self.pixmap = None
|
||||||
self.acceptDrops()
|
self.acceptDrops()
|
||||||
self.setWindowTitle("Image")
|
self.setWindowTitle("Image")
|
||||||
self.setGeometry(0, 0, 600, 450)
|
|
||||||
self.label = QLabel(self)
|
|
||||||
self.delta = 0.02
|
self.delta = 0.02
|
||||||
self.lon = 37.530887
|
self.lon = 37.530887
|
||||||
self.lat = 55.703118
|
self.lat = 55.703118
|
||||||
self.variant_map = "map"
|
self.variant_map = "map"
|
||||||
get_img_map(self.delta, (self.lon, self.lat), self.variant_map)
|
self.update()
|
||||||
self.pixmap = QPixmap('image.png')
|
self.button_group = QButtonGroup()
|
||||||
self.label.setPixmap(self.pixmap)
|
self.button_group.addButton(self.map)
|
||||||
self.label.resize(self.pixmap.width(), self.pixmap.height())
|
self.button_group.addButton(self.sat)
|
||||||
self.show()
|
self.button_group.addButton(self.skl)
|
||||||
|
self.button_group.buttonClicked.connect(self.push_button)
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
try:
|
try:
|
||||||
@@ -53,6 +55,13 @@ class Window(QMainWindow):
|
|||||||
self.label.resize(self.pixmap.width(), self.pixmap.height())
|
self.label.resize(self.pixmap.width(), self.pixmap.height())
|
||||||
self.show()
|
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)
|
App = QApplication(sys.argv)
|
||||||
window = Window()
|
window = Window()
|
||||||
|
|||||||
Reference in New Issue
Block a user