Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0125· openaiHugging Face Suzhen/CodeChat

Как здесь правильнее снижать размер окна: if event.pos().x() > self.scaleStartPos.x()…

  1. 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()

  2. 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()), будет увеличиваться ширина окна, а при перемещении влево уменьшаться.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.