如下所示:
#!/usr/bin/evn python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QScrollArea, QLabel)
from PyQt5.QtCore import QEvent
class TestWindow(QWidget):
def __init__(self):
super(TestWindow, self).__init__()
self.resize(800, 600)
self.move(0, 0)
# self.setMouseTracking(False)
self.last_time_move = 0
self.initUI()
def initUI(self):
self.central_widget = QWidget(self)
self.scroll_area = QScrollArea(self)
self.scroll_area.setGeometry(0, 0, 400, 400)
self.scroll_area.setWidgetResizable(True)
self.scroll_bar = self.scroll_area.verticalScrollBar()
self.scroll_contents = QWidget()
self.scroll_contents.setGeometry(0, 0, 400, 800)
self.scroll_contents.setMinimumSize(380, 1000)
self.label_