Skip to content

Commit

Permalink
float -> int where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
buha committed Oct 31, 2024
1 parent 8f12563 commit fb61005
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions game-of-life.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QSize
import design
from random import randint

Expand All @@ -13,7 +13,7 @@ def __init__(self, screen_width, screen_height, c1, c2):
self.ui.setupUi(self)

# resize the main window to a sensible value
self.resize(screen_width / 2, screen_height / 2)
self.resize(QSize(int(screen_width / 2), int(screen_height / 2)))

# resize the graphics scene to match the window
uv = self.ui.graphicsView
Expand Down
8 changes: 4 additions & 4 deletions universeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def seed(self, state):
self.universe.seed(state)

def start(self):
self._timer.start(constants.DefaultAtomicTick * 1000)
self._timer.start(int(constants.DefaultAtomicTick * 1000))
self.frame_timestamps = []
self.start_t = perf_counter()

Expand Down Expand Up @@ -189,7 +189,7 @@ def keyPressEvent(self, QKeyEvent):
if self._timer.isActive():
self.stop()
else:
self._timer.start(self._timerTickPeriod * 1000)
self._timer.start(int(self._timerTickPeriod * 1000))

elif QKeyEvent.key() == Qt.Key_S:
self._showStatus = not self._showStatus
Expand All @@ -211,11 +211,11 @@ def keyPressEvent(self, QKeyEvent):

elif QKeyEvent.key() == Qt.Key_Minus:
self._timerTickPeriod *= 1.05
self._timer.setInterval(self._timerTickPeriod * 1000)
self._timer.setInterval(int(self._timerTickPeriod * 1000))

elif QKeyEvent.key() == Qt.Key_Plus:
self._timerTickPeriod /= 1.05
self._timer.setInterval(self._timerTickPeriod * 1000)
self._timer.setInterval(int(self._timerTickPeriod * 1000))

self.reDraw()
QGraphicsView.keyPressEvent(self, QKeyEvent)
Expand Down

0 comments on commit fb61005

Please sign in to comment.