How to convert python file to .exe file
Watch a video on how to convert the game you developed in pyleap to an executable file. So that you can share among your friends and let them play without installing python and pyleap.
Watch a video on how to convert the game you developed in pyleap to an executable file. So that you can share among your friends and let them play without installing python and pyleap.
Keys that we can use to trigger an action:➢ Letters – A, B, C, D, E, F, G, . . .➢ Numbers – _1, _2, _3, _4, . . . (since we cannot start a variable name by numbers we have to use underscore)➢ Arrow keys – LEFT, RIGHT, UP, DOWN➢ Function keys – F1, […]
Attributes: mouse.x = returns the x-coordinate of mouse position mouse.y = returns the y-coordinate of mouse position mouse.LEFT = returns True if the left mouse button is pressed mouse.RIGHT = returns True if the right mouse button is pressed Methods: on_move(function) – The function will be called when the mouse moves. on_press(function) – The function will be called when left mouse […]
Rotation: Sets the rotation angle. Default is 0 or 360 degrees. The anchor of rotation by default will be at the center of the sprite and the rotation happens in an anti-clockwise direction. Syntax: set_anchor(x, y): Sets an anchor point for the rotation of a sprite to x and y. (OR) Sets the center point […]
Opacity: Changes the opacity of a sprite. The default value is 1(1 means opaque and 0 means transparent). We can use the opacity value between 0 and 1. Syntax to use opacity: Check about the random methods here
Transformation is all about changing the scale(changing the size): The default value is 1. We can scale from 0 to 1. 1. scale (scaling both x and y values) 2. scale_x (horizontal scale of the sprite) 3. scale_y (vertical scale of the sprite) Project: School Bus Source code: Output:
Image To insert an image we have to use the Sprite method. Syntax: url = file path or url of the Sprite (image format should be specified)x = x-coordinate of the center of the spritey = y-coordinate of the center of the sprite Text Syntax: src = Text contentx, y = position of the bottom […]
There are two drawing methods to draw shapes in pyleap: draw() – will draw complete graphic on the canvas. stroke() – will draw only the stroke line of the shape. Now, let’s look into drawing different types of shapes in pyleap: 1. Line x1 = x-coordinate of the start point of the liney1 = y-coordinate […]
The four handy window methods are explained with an example: 1. window.set_size() A default window size is width = 640 and height=480. But you can change as per your requirement. To change your window size use the command: 2. window.set_caption() By default, the window caption will be leap learner but you can change using the […]