Как здесь правильнее снижать размер окна: if event.pos().x() > self.scaleStartPos.x()…
- User
Как здесь правильнее снижать размер окна: if event.pos().x() > self.scaleStartPos.x() and event.pos().x() > self.coordinates[0] + self.coordinates[2]: print(“chlen”) self.coordinates[2] = event.pos().x() - self.coordinates[0] if event.pos().x() < self.scaleStartPos.x() and event.pos().x() < self.coordinates[0] + self.coordinates[2]: print(“chlen”) self.coordinates[2] -= event.pos().x()
- Assistant
Для уменьшения размера окна в данном случае, можно использовать следующий код:
if event.pos().x() > self.scaleStartPos.x(): self.coordinates[2] = event.pos().x() - self.coordinates[0] elif event.pos().x() < self.coordinates[0] + self.coordinates[2]: self.coordinates[2] -= event.pos().x()Таким образом, при перемещении мыши вправо от начальной позиции (self.scaleStartPos.x()), будет увеличиваться ширина окна, а при перемещении влево уменьшаться.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.