How to show a timer on screen using arcade in Python3? Last Updated : 20 Oct, 2020 Comments Improve Suggest changes Like Article Like Report Prerequisite: Arcade library Arcade is a modern framework, which is used to make 2D video games. In this, article, you will learn how to show an on-screen timer using the arcade module of Python. Displaying a timer on screen is not tough job, just follow the below steps:- Step 1: First of all import the arcade module of Python Python3 import arcade Step 2: Define parameters necessary for the output screen. Python3 WIDTH = 800 HEIGHT = 600 TITLE = "Timer" Step 3: Define a class MYTimer and under that class, set the background color and starting time. Python3 class MyTimer(arcade.Window): def setup(self): arcade.set_background_color(arcade.color.WHITE) self.total_time = 0.0 Step 4: Under MyTimer class, define one function to calculate the minutes and seconds. Python3 def on_draw(self): # Start the render. arcade.start_render() # Calculate minutes minutes = int(self.total_time) // 60 # Calculate seconds by using a modulus seconds = int(self.total_time) % 60 # Figure out your output output = f"Time: {minutes:02d}:{seconds:02d}" # Output the timer text. arcade.draw_text(output, 300, 300, arcade.color.BOTTLE_GREEN, 45) Step 5: Now, define an on_update function to update time with each increasing minutes and seconds. Python3 def on_update(self, delta_time): self.total_time += delta_time Step 6: Last and foremost step is to define main() and call it in the end. Python3 def main(): window = MyTimer() window.setup() arcade.run() main() Complete code Python3 #import module import arcade # screen parameters SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_TITLE = "Timer " # define class class MyTimer(arcade.Window): def setup(self): arcade.set_background_color(arcade.color.WHITE) self.total_time = 0.0 def on_draw(self): # Start the render. arcade.start_render() # Calculate minutes minutes = int(self.total_time) // 60 # Calculate seconds by using a modulus seconds = int(self.total_time) % 60 # Figure out your output output = f"Time: {minutes:02d}:{seconds:02d}" # Output the timer text. arcade.draw_text(output, 300, 300, arcade.color.BOTTLE_GREEN, 45) # update def on_update(self, delta_time): self.total_time += delta_time # main function def main(): window = MyTimer() window.setup() arcade.run() # call main function main() Output: Comment More infoAdvertise with us Next Article How to show a timer on screen using arcade in Python3? A anshitaagarwal Follow Improve Article Tags : Python Python-Arcade Practice Tags : python Similar Reads Set Countdown timer to Capture Image using Python-OpenCV Prerequisites: Introduction to OpenCV Most of us have already captured image using countdown timer with our phones. We can do the same thing on our computer with the help of OpenCV. But here we can specify the countdown timer instead of choosing one of the specified countdown and whenever the partic 3 min read How to add time delay in Python? A time delay means pausing the program for a short period before continuing to the next step. This is useful when you want to slow down the execution, like waiting between messages or steps in a loop. In Python, you can add a delay using the sleep() function from the time module, where you specify h 4 min read Draw a sun using arcade library Python You might have drawn Sun using famous Python module like turtle but here we discuss how the same approach can be achieved using arcade module. The Arcade library is a modern Python Module used widely for developing 2D video games with compelling graphics and sound. Arcade is an object-oriented libra 2 min read How to set an input time limit in Python? In this article, we will explain how to set an input time limit in Python. It is one of the easiest programming languages which is not only dynamically typed but also garbage collected. Here we will look at different methods to set an input time limit. Below are the methods we will use in this artic 6 min read How to show webcam in TkInter Window - Python Python offers various modules for creating GUI applications, out of which, Tkinter lets users do various tasks inside their app. Thus, while creating a GUI app, have you ever felt the need to let the user open the camera on a specific condition? Don't know, how to achieve that. Continue reading this 4 min read Like