PgUp и PgDown

This commit is contained in:
2023-01-30 18:57:31 +07:00
parent 8e144b01e5
commit 1630f048f8
3 changed files with 29 additions and 9 deletions
+22 -1
View File
@@ -1,6 +1,7 @@
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap
import sys
from PyQt5 import QtCore
from functions.get_img_map import get_img_map
@@ -11,7 +12,27 @@ class Window(QMainWindow):
self.setWindowTitle("Image")
self.setGeometry(0, 0, 600, 450)
self.label = QLabel(self)
get_img_map()
self.delta = 0.02
get_img_map(self.delta)
self.pixmap = QPixmap('image.png')
self.label.setPixmap(self.pixmap)
self.label.resize(self.pixmap.width(), self.pixmap.height())
self.show()
def keyPressEvent(self, event):
try:
if event.key() == QtCore.Qt.Key_Up:
self.delta += 0.01
self.update()
if event.key() == QtCore.Qt.Key_Down:
self.delta -= 0.01
self.update()
event.accept()
except Exception as e:
print(e)
def update(self):
get_img_map(self.delta)
self.pixmap = QPixmap('image.png')
self.label.setPixmap(self.pixmap)
self.label.resize(self.pixmap.width(), self.pixmap.height())