Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Converting Angle to X and Y Values: 90/180/270 deg
Post: Converting Angle to X and Y Values: 90/180/270 deg

So I have a way to turn an angle into x and y values: angle = math.radians(0) y = math.cos(angle) x = math.sin(angle) print(x,y)and it prints: Output:0.0 1.0but then, I change they 0 to 90: angle = ma...
qrani General Coding Help 1 2,777 Nov-21-2018, 06:10 PM
    Thread: finding angle between three points on a 2d graph
Post: RE: finding angle between three points on a 2d gra...

here is what i have so far:import math p1x = 0 p1y = 5 p2x = 0 p2y = 0 p3x = 5 p3y = 0 angle1 = (math.atan2(p3y - p1y, p3x - p1x) - math.atan2(p2y - p1y, p2x - p1x)) print(angle1)based on something i ...
qrani General Coding Help 4 14,111 Nov-20-2018, 01:14 AM
    Thread: finding angle between three points on a 2d graph
Post: finding angle between three points on a 2d graph

So, i've been trying to find this out for such a long time. So say I have three points A, B, C. Each with X and Y values. ax = 1 ay = 5 bx = 1 by = 2 cx = 5 cy = 1 which looks something like this on a...
qrani General Coding Help 4 14,111 Nov-19-2018, 01:11 AM
    Thread: PyGame: detecting key press, but not key
Post: RE: PyGame: detecting key press, but not key

thanks
qrani Game Development 2 3,994 Sep-28-2018, 11:08 PM
    Thread: PyGame: detecting key press, but not key
Post: PyGame: detecting key press, but not key

I can't get it to detect what key is being pressed. import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((640, 400)) while True: for event in pygame.event.get()...
qrani Game Development 2 3,994 Sep-28-2018, 10:16 PM
    Thread: writing bytes error
Post: RE: writing bytes error

thanks!
qrani General Coding Help 4 2,951 Sep-22-2018, 09:00 PM
    Thread: writing bytes error
Post: RE: writing bytes error

I did this: string1 = 'b"abc123test"' f = open('file.txt', "wb") f.write(string1) f.close()and it gave the same error
qrani General Coding Help 4 2,951 Sep-22-2018, 07:12 PM
    Thread: writing bytes error
Post: writing bytes error

When I am writing bytes to a file using this: string1 = "abc123test" f = open(filewrite, "wb") f.write(string1) f.close()it gives me this error: Error: f.write(string1) TypeError: a bytes-like obje...
qrani General Coding Help 4 2,951 Sep-22-2018, 06:16 PM
    Thread: reading the binary contents of any file
Post: RE: reading the binary contents of any file

so i have the file: file1.txt and its contents are: abc this is what i did with open(file1.txt, 'rb') as f: # Open data input file f_contents = f.read() print(f_contents)and it gave me this:...
qrani General Coding Help 4 3,018 Sep-15-2018, 08:18 PM
    Thread: reading the binary contents of any file
Post: reading the binary contents of any file

I was wondering how to make it so I can load the binary of any file so say I have a file called, file1.qra (qra is made up) and the binary contents of it are: 011000010110001001100011 I wanna be able ...
qrani General Coding Help 4 3,018 Sep-15-2018, 07:18 PM
    Thread: py.exe: printing ascii number 7
Post: py.exe: printing ascii number 7

I was messing around in python with ascii, And I found something I think is interesting. This: quitfunc = 'r' while(quitfunc == 'r'): ascnum = input('input an ascii number\nstandard 0-127\n') ...
qrani News and Discussions 3 3,482 Aug-27-2018, 01:12 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020