r/pythonhelp • • Mar 13 '19

Help with schoolwork please.

0 Upvotes

I'm completely new to python and i need help with this if statement. I can't figure out why it's not working correctly Any suggestions?

if Correct=="yes"or"Yes"

print("Thank you for choosing Takers Travels, we hope to see you soon!")

elif Correct=="no"or"No":

print("Please refresh the page and re-enter your personal information")


r/pythonhelp • • Aug 08 '19

turn on phone flashlight via python

0 Upvotes

I want to turn on my phones built in flashlight in python. I am not sure how to do it. If you know how please tell me.


r/pythonhelp • • Nov 11 '23

My simple python program does not execute the last line

0 Upvotes

I have a simple Firefox extension, I have pretty much figured out the Firefox side of things (JavaScript, DOM and starting the Python program).

To explain how everything is supposed to work:

  1. A event occurs in the browser

  2. Firefox launches the Python program on the local system (achieved with Native Messaging)

  3. Firefox passes a one time message to the Python program via stdin

After step 3, Firefox is meant to exit the picture and Python is supposed to take over.

I am stuck on the Python part of this process. The python program does receive the message from Firefox, via stdin. But once execution goes past the line receivedMessage = getMessage(), I start to get odd behaviour. For example the last line subprocess.Popen(... is never executed. Even if I were to launch the Python program manually, say double clicking it in File explorer, the last line never executes.

The only way to make it execute is by commenting out receivedMessage = getMessage().

import subprocess
import json
import struct
import sys

def getMessage():
	rawLength = sys.stdin.buffer.read(4)
	messageLength = struct.unpack('@I', rawLength)[0]
	message = sys.stdin.buffer.read(messageLength).decode('utf-8')
	return json.loads(message)

receivedMessage = getMessage()
#subprocess.Popen(["explorer", "C:/Temp"])			  #Is never executed
subprocess.Popen(['pwsh', 'C:/Temp/testProg.ps1'])   #Is never executed

The core of the program is an example I got from the MDN documentation page, that I reworked by getting rid of the redundant parts. I don't know the technical details behind stdin and how its specifically implemented in Python, I understand it at a high level only.

What could be holding back the execution of the program? Could it be held up by Firefox still streaming data to it?

Any help would be greatly appreciated!


r/pythonhelp • • Nov 11 '23

Hello yall, I am creating a Multiplicative Cipher and I got everything working except the decrypt function. When I try to put the user input for decrypt, it doesn't show the decrypted message. I did use some AI but everything is working except the decrypt function. Thank you.

Thumbnail
pastebin.com
0 Upvotes

r/pythonhelp • • Nov 09 '23

Why is my Canvas Account ID not processing?

0 Upvotes

I'm designing a Canvas LMS API, and I need to access my enrollments for my account, so I need to make an Object for my Account. My code looks like this:

acct = canvas.get_account(51472)

It returns an Exception:

Traceback (most recent call last):

File "c:\Users\pdevh\OneDrive\CodingProjects\Canvas API\EduNet.py", line 16, in <module>

acct = canvas.get_account(51472)

File "C:\Users\pdevh\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\canvasapi\canvas.py", line 409, in get_account

response = self.__requester.request(

File "C:\Users\pdevh\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\canvasapi\requester.py", line 255, in request

raise ResourceDoesNotExist("Not Found")

canvasapi.exceptions.ResourceDoesNotExist: Not Found


r/pythonhelp • • Dec 15 '23

Reverse linked list recursive solution

0 Upvotes

Hello! Can someone explain me why new_head is changing every time head is changing.

def reverse_list(head):
if not head:
    return None

new_head = head
if head.next:
    new_head = reverse_list(head.next)
    head.next.next = head
head.next = None

return new_head

r/pythonhelp • • Nov 30 '23

code to do a minimised chi squared fit on a function by varying two variables in python for a function with a maximum point not working correctly

0 Upvotes

I have written a piece of code intended to perform a minimised chi squared fit by varying two parameters, the problem section of code is below:

conversion_factor = 0.3894 * 10**9

def cross_section(parameters, E,Γee):

mZ, ΓZ = parameters

return conversion_factor * (12*np.pi/(mZ**2))*((E**2)/((E**2-mZ**2)**2)+(mZ**2)*(ΓZ**2))*(Γee**2)

def chi_squared(parameters, E, sigma, sigma_error, mZ_start, ΓZ_start, Γee):

mZ, ΓZ = parameters

model = cross_section(parameters, E,Γee)

return np.sum(((model - sigma) / sigma_error) ** 2)

E = combined_data['% centre-of-mass energy (GeV)']

sigma = combined_data['cross section (nb)']

sigma_error = combined_data['uncertainty (nb)']

mZ_start, ΓZ_start= [90, 3]

Γee= 83.91

result = fmin(chi_squared, (mZ_start, ΓZ_start), args=(E, sigma, sigma_error, mZ_start, ΓZ_start, Γee),full_output=True, disp=False)

print(result[0][0])

print(result[0][1])

The code only returns my initial values of mZ_start and ΓZ_start, not the maximum point of my chi squared fit. Can anybody help me understand why?


r/pythonhelp • • Sep 03 '23

I need an advice.I can't save file like:"FILE.py",only "FILE.py.txt"

0 Upvotes

So i started coding,but there's one problem.When i finished to write code,i saved file like: FILE.py ,but i can't run it.When i clicked on the file , notepad started running with code in it.I can't choose/change default program to run this file.I started searching on the internet,but i didn't find nothing at all.If someone can help me, thanks 🙏.


r/pythonhelp • • Oct 22 '23

How do I use the index of an item in a list in a list?

0 Upvotes

I have a variable that = [["username2", "password2"], ["username1", "password1"]] and I want to authenticate the username and password in a function that is laid out like this:

EDIT: The indentation did not cross over but def authenticate_user() indents everything below, there is a space between password and for user_entry... then indented after that is return True and the rest is at the same indentation as the for statement. Sorry!

def authenticate_user():

username = input("Username: ")

password = input("Password: ")

for user_entry in users:

if user_entry[0] == username and user_entry[1] == password:

return True

print("Authentication Failed.")

return False

I'm running in to the issue that it's always returning False but the user_entry[0] is outputting the first list inside of the original variable, and the same applies to user_entry[1] and I don't know how to go deeper to access the appropriate values?

Any help would be appreciated as I'm relatively new to python.


r/pythonhelp • • May 09 '22

Do I need to secure the .exe file after converting it from a .py file?

0 Upvotes

Hello, I've just downloaded Python, I made a script and made an .exe app, I sent it to my friend to try it out and it said it was unsecure, on my device it's nothing. do I need to secure the executable file or something? Thanks.

Here's the script:

import webbrowser
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
webbrowser.open(url)


r/pythonhelp • • Apr 25 '22

Gui to parse authlog turned list

0 Upvotes

I need to create a gui that searches through a list and prints everything in a scrollable list box.

I am currently having an issue trying to have my dates be the


r/pythonhelp • • May 23 '22

HOMEWORK Split Lines between Two Points

0 Upvotes

I have a file that has some random words at the start and end on different amounts of lines each time. I am trying to only read the lines between the first point *** START OF SYNTHETIC TEST CASE *** and the second point *** END OF SYNTHETIC TEST CASE ***. How would I go about writing this


r/pythonhelp • • Apr 25 '22

How to load a (working) python code

0 Upvotes

Dear Community,

I won't lie I am coming here in a time of need and am not a contributor nor silent reader on this reddit.

I decided to continue working on a university project. At firsy the project was done by in total 3 people (including me) and one of the other 2 guys was the guy responsible for the python code. I ended up having to rework the code in order to process the data a little bit differently in my followup project. First I thought I'd be able to do that by trial and error but before I even could get to that I had to load the code into Pandas. And I cant. There are so many modules and things I can't even lookup properly that it kind of made me feel ashamed for having thought I could do that by myself.

I am currently on my way back from work and will post some details later. But there are so many questions that I just thought if someone has the time to hop on discord/Skype/teams or whatever with me I could ask for that in advance. Of course I am willing to pay for any help provided at a rate of 5€ per 15 minutes (so 20€ for an hour).

Interested people can DM me.

Thanks!

Best regards


r/pythonhelp • • Apr 24 '22

with a python project

0 Upvotes

Hi I need help with a python project. It’s for school and I don’t even know how to get started. I need someone to help me get through because it’s due tonight. Please can someone help my grade is on the line I really need it


r/pythonhelp • • May 04 '22

I can't run my oTree project

0 Upvotes

When I try to run oTree with `otree devserver' command in my project folder's shell, I get the following error:

Traceback (most recent call last):   File "C:\Users\Username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\otree\database.py", line 268, in init_orm     models = get_models_module(app)   File "C:\Users\Username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\otree\common.py", line 75, in get_models_module     return import_module(module_name)   File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\importlib__init__.py", line 127, in import_module     return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked   File "<frozen importlib._bootstrap_external>", line 850, in exec_module   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed   File "C:\Users\Username\Desktop\oTree\chp1a\models.py", line 6, in <module>     from otree.db import models ModuleNotFoundError: No module named 'otree.db' 

I was searching for this issue on Google but I couldn't find anything useful. I'm using Windows10, oTree version: 5.8.1. I tried to reinstall oTree but it didn't work. What can I do?


r/pythonhelp • • Apr 29 '22

How do I remove/add certain characters to a sentence?

0 Upvotes

Hi there, I’m new to python and I have to make a simple translator app that requires changing/removing words with certain criteria from an inputted sentence. Can anyone tell me how I’d do that? Below is the question for reference:

During a camping trip, your family came up with a secret language. Since you are doing an Information Systems course, your family asked you to make a program to help translate English to your secret language. The secret language works this way: If a word begins with a vowel (a, e, i, o, u) - you add "py" to the end of the word. If a word begins with a consonant - you remove that first consonant. Write a program that uses a function to translate a given English sentence to the secret language. Test your function by printing the sentence: "An espresso a day keeps the doctor away". It should print the following “Anpy espressopy apy ay eeps he octor awaypy”.


r/pythonhelp • • May 10 '22

Karel World Helps

0 Upvotes

currently trying to beat my friend by using as minimal code as possible to fill the entire karel large world he says he has 19 but I'm a bit stuck can someone help


r/pythonhelp • • Feb 27 '21

Help I am stuck on the second half of figuring out this python code.

Post image
0 Upvotes

r/pythonhelp • • Feb 10 '21

What Now ? resources ?

0 Upvotes

So i've posted the same thing twice now but now I have another part to my question. After completing my python tutorial and learning all about methods, functions, etc where do I go now? There's obv so much more to learn does anyone have any resources that could be helpful. I've mostly just been studying the python cheat sheet reading but I'm getting bored lol.


r/pythonhelp • • Apr 26 '20

My file output is incorrect?

0 Upvotes

I am currently learning Python, and the script I wrote 'mostly' works, but the output is wrong. Here's the code.

The output in the console has significantly more lines than the .txt file that was output. Is there some kind of limit to how much can be written to a file?


r/pythonhelp • • May 01 '20

Hellpppp

0 Upvotes

Does anybody have the teals program lab 4.04 in python


r/pythonhelp • • Apr 19 '20

Python help. My python code splits into four commands, I need help In coding a user interface so that the user can choose from, such as A, B, C, D

0 Upvotes

r/pythonhelp • • May 03 '20

I NEED HELP

0 Upvotes

im trying to get this code to work in pycharm and if anyone could tell be why or give me tips on how to fix it that would be great

from os import path

from pygame import *
from pygame.locals import *
from pygame import init, image, display, locals
from pygame.mixer import SoundType

init()

scr_size = (width,height) = (600,150)
FPS = 60
gravity = 0.6
black = (0,0,0)
white = (255,255,255)
background_col = (235,235,235)

high_score = 0
screen = display.set_mode(scr_size)
clock = time.Clock()
display.set_caption("Dino Run ")

def load_image(
name,
sizex=-1,
sizey=-1,
colorkey=None,
):

fullname = os.path.join('sprites', name)
image = pygame.image.load(fullname)
image = image.convert()
if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0, 0))
image.set_colorkey(colorkey, RLEACCEL)

if sizex != -1 or sizey != -1:
image = pygame.transform.scale(image, (sizex, sizey))

return (image, image.get_rect())

def load_sprite_sheet(
sheetname,
nx,
ny,
scalex = -1,
scaley = -1,
colorkey = None,
):
"""
:rtype*: object*
"""
# type: (object, object, object, object, object, object) -> object
fullname = path.join('sprites',sheetname)
sheet = image.load(fullname)
sheet = sheet.convert()

sheet_rect = sheet.get_rect()

sprites = []

sizex = sheet_rect.width/nx
sizey = sheet_rect.height/ny

for i in range(0,ny):
for j in range(0,nx):
rect = pygame.Rect((j*sizex,i*sizey,sizex,sizey))
image = pygame.Surface(rect.size)
image = image.convert()
image.blit(sheet,(0,0),rect)

if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0,0))
image.set_colorkey(colorkey,RLEACCEL)

if scalex != -1 or scaley != -1:
image = pygame.transform.scale(image,(scalex,scaley))

sprites.append(image)

sprite_rect = sprites[0].get_rect()

return sprites,sprite_rect

def disp_gameOver_msg(retbutton_image,gameover_image):
retbutton_rect = retbutton_image.get_rect()
retbutton_rect.centerx = width / 2
retbutton_rect.top = height*0.52
gameover_rect = gameover_image.get_rect()
gameover_rect.centerx = width / 2
gameover_rect.centery = height*0.35
screen.blit(retbutton_image, retbutton_rect)
screen.blit(gameover_image, gameover_rect)

def extractDigits(number):
if number > -1:
digits = []
i = 0
while(number/10 != 0):
digits.append(number%10)
number = int(number/10)

digits.append(number%10)
for i in range(len(digits),5):
digits.append(0)
digits.reverse()
return digits

class Dino():
def __init__(self,sizex=-1,sizey=-1):
self.images,self.rect = load_sprite_sheet('dino.png',5,1,sizex,sizey,-1)
self.images1,self.rect1 = load_sprite_sheet('dino_ducking.png',2,1,60,sizey,-1)
self.rect.bottom = int(0.98*height)
self.rect.left = width/15
self.image = self.images[0]
self.index = 0
self.counter = 0
self.score = 0
self.isJumping = False
self.isDead = False
self.isDucking = False
self.isBlinking = False
self.movement = [0,0]
self.jumpSpeed = 11.5
self.stand_pos_width = self.rect.width
self.duck_pos_width = self.rect1.width

def draw(self):
screen.blit(self.image,self.rect)

def checkbounds(self):
if self.rect.bottom > int(0.98*height):
self.rect.bottom = int(0.98*height)
self.isJumping = False
def update(self):
if self.isJumping:
self.movement[1] = self.movement[1] + gravity

if self.isJumping:
self.index = 0
elif self.isBlinking:
if self.index == 0:
if self.counter % 400 == 399:
self.index = (self.index + 1)%2
else:
if self.counter % 20 == 19:
self.index = (self.index + 1)%2
elif self.isDucking:
if self.counter % 5 == 0:
self.index = (self.index + 1)%2
else:
if self.counter % 5 == 0:
self.index = (self.index + 1)%2 + 2
if self.isDead:
self.index = 4
if not self.isDucking:
self.image = self.images[self.index]
self.rect.width = self.stand_pos_width
else:
self.image = self.images1[(self.index)%2]
self.rect.width = self.duck_pos_width

self.rect = self.rect.move(self.movement)
self.checkbounds()

if not self.isDead and self.counter % 7 == 6 and self.isBlinking == False:
self.score += 1
if self.score % 100 == 0 and self.score != 0:
if pygame.mixer.get_init() != None:
checkPoint_sound.play()

self.counter = (self.counter + 1)

class Cactus(sprite.Sprite):
def __init__(self,speed=5,sizex=-1,sizey=-1):
pygame.sprite.Sprite.__init__(self,self.containers)
self.images,self.rect = load_sprite_sheet('cacti-small.png',3,1,sizex,sizey,-1)
self.rect.bottom = int(0.98*height)
self.rect.left = width + self.rect.width
self.image = self.images[random.randrange(0,3)]
self.movement = [-1*speed,0]

def draw(self):
screen.blit(self.image,self.rect)

def update(self):
self.rect = self.rect.move(self.movement)

if self.rect.right < 0:
self.kill()

class Ptera(sprite.Sprite):
def __init__(self,speed=5,sizex=-1,sizey=-1):
pygame.sprite.Sprite.__init__(self,self.containers)
[self.images, self.rect] = load_sprite_sheet('ptera.png', 2, 1, sizex, sizey, -1)
self.ptera_height = [height*0.82,height*0.75,height*0.60]
self.rect.centery = self.ptera_height[random.randrange(0,3)]
self.rect.left = width + self.rect.width
self.image = self.images[0]
self.movement = [-1*speed,0]
self.index = 0
self.counter = 0
def draw(self):
screen.blit(self.image,self.rect)

def update(self):
if self.counter % 10 == 0:
self.index = (self.index+1)%2
self.image = self.images[self.index]
self.rect = self.rect.move(self.movement)
self.counter = (self.counter + 1)
if self.rect.right < 0:
self.kill()

class Ground():
def __init__(self,speed=-5):
self.image,self.rect = load_image('ground.png',-1,-1,-1)
self.image1,self.rect1 = load_image('ground.png',-1,-1,-1)
self.rect.bottom = height
self.rect1.bottom = height
self.rect1.left = self.rect.right
self.speed = speed

def draw(self):
screen.blit(self.image,self.rect)
screen.blit(self.image1,self.rect1)

def update(self):
self.rect.left += self.speed
self.rect1.left += self.speed

if self.rect.right < 0:
self.rect.left = self.rect1.right

if self.rect1.right < 0:
self.rect1.left = self.rect.right

class Cloud(sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self,self.containers)
self.image,self.rect = load_image('cloud.png',int(90*30/42),30,-1)
self.speed = 1
self.rect.left = x
self.rect.top = y
self.movement = [-1*self.speed,0]

def draw(self):
screen.blit(self.image,self.rect)

def update(self):
self.rect = self.rect.move(self.movement)
if self.rect.right < 0:
self.kill()

class Scoreboard():
def __init__(self,x=-1,y=-1):
self.score = 0
self.tempimages,self.temprect = load_sprite_sheet('numbers.png',12,1,11,int(11*6/5),-1)
self.image = pygame.Surface((55,int(11*6/5)))
self.rect = self.image.get_rect()
if x == -1:
self.rect.left = width*0.89
else:
self.rect.left = x
if y == -1:
self.rect.top = height*0.1
else:
self.rect.top = y

def draw(self):
screen.blit(self.image,self.rect)

def update(self,score):
score_digits = extractDigits(score)
self.image.fill(background_col)
for s in score_digits:
self.image.blit(self.tempimages[s],self.temprect)
self.temprect.left += self.temprect.width
self.temprect.left = 0
def introscreen():
global introscreen

temp_dino = Dino(44,47)
temp_dino.isBlinking = True
gameStart = False
temp_ground,temp_ground_rect = load_sprite_sheet('ground.png',15,1,-1,-1,-1)
temp_ground_rect.left = width/20
temp_ground_rect.bottom = height

logo,logo_rect = load_image('logo.png',300,140,-1)
logo_rect.centerx = width*0.6
logo_rect.centery = height*0.6
while not gameStart:
if pygame.display.get_surface() == None:
print("Couldn't load display surface")
return True
else:
for event in pygame.event.get():
if event.type == pygame.QUIT:
return True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE or event.key == pygame.K_UP:
temp_dino.isJumping = True
temp_dino.isBlinking = False
temp_dino.movement[1] = -1*temp_dino.jumpSpeed

temp_dino.update()

if pygame.display.get_surface() != None:
screen.fill(background_col)
screen.blit(temp_ground[0],temp_ground_rect)
if temp_dino.isBlinking:
screen.blit(logo,logo_rect)
temp_dino.draw()

pygame.display.update()

clock.tick(FPS)
if temp_dino.isJumping == False and temp_dino.isBlinking == False:
gameStart = True
def gameplay():
global high_score
gamespeed = 4
startMenu = False
gameOver = False
gameQuit = False
playerDino = Dino(44,47)
new_ground = Ground(-1*gamespeed)
scb = Scoreboard()
highsc = Scoreboard(width*0.78)
counter = 0
cacti = pygame.sprite.Group()
pteras = pygame.sprite.Group()
clouds = pygame.sprite.Group()
last_obstacle = pygame.sprite.Group()

Cactus.containers = cacti
Ptera.containers = pteras
Cloud.containers = clouds

retbutton_image,retbutton_rect = load_image('replay_button.png',35,31,-1)
gameover_image,gameover_rect = load_image('game_over.png',190,11,-1)

temp_images,temp_rect = load_sprite_sheet('numbers.png',12,1,11,int(11*6/5),-1)
HI_image = pygame.Surface((22,int(11*6/5)))
HI_rect = HI_image.get_rect()
HI_image.fill(background_col)
HI_image.blit(temp_images[10],temp_rect)
temp_rect.left += temp_rect.width
HI_image.blit(temp_images[11],temp_rect)
HI_rect.top = height*0.1
HI_rect.left = width*0.73
while not gameQuit:
while startMenu:
pass
while not gameOver:
if pygame.display.get_surface() == None:
print("Couldn't load display surface")
gameQuit = True
gameOver = True
else:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameQuit = True
gameOver = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
if playerDino.rect.bottom == int(0.98*height):
playerDino.isJumping = True
if pygame.mixer.get_init() != None:
jump_sound.play()
playerDino.movement[1] = -1*playerDino.jumpSpeed

if event.key == pygame.K_DOWN:
if not (playerDino.isJumping and playerDino.isDead):
playerDino.isDucking = True
if event.type == pygame.KEYUP:
if event.key == pygame.K_DOWN:
playerDino.isDucking = False
for c in cacti:
c.movement[0] = -1*gamespeed
if pygame.sprite.collide_mask(playerDino,c):
playerDino.isDead = True
if pygame.mixer.get_init() != None:
die_sound.play()

for p in pteras:
p.movement[0] = -1*gamespeed
if pygame.sprite.collide_mask(playerDino,p):
playerDino.isDead = True
if pygame.mixer.get_init() != None:
die_sound.play()

if len(cacti) < 2:
if len(cacti) == 0:
last_obstacle.empty()
last_obstacle.add(Cactus(gamespeed,40,40))
else:
for l in last_obstacle:
if l.rect.right < width*0.7 and random.randrange(0,50) == 10:
last_obstacle.empty()
last_obstacle.add(Cactus(gamespeed, 40, 40))

if len(pteras) == 0 and random.randrange(0,200) == 10 and counter > 500:
for l in last_obstacle:
if l.rect.right < width*0.8:
last_obstacle.empty()
last_obstacle.add(Ptera(gamespeed, 46, 40))

if len(clouds) < 5 and random.randrange(0,300) == 10:
Cloud(width,random.randrange(height/5,height/2))

playerDino.update()
cacti.update()
pteras.update()
clouds.update()
new_ground.update()
scb.update(playerDino.score)
highsc.update(high_score)

if pygame.display.get_surface() != None:
screen.fill(background_col)
new_ground.draw()
clouds.draw(screen)
scb.draw()
if high_score != 0:
highsc.draw()
screen.blit(HI_image,HI_rect)
cacti.draw(screen)
pteras.draw(screen)
playerDino.draw()

pygame.display.update()
clock.tick(FPS)

if playerDino.isDead:
gameOver = True
if playerDino.score > high_score:
high_score = playerDino.score

if counter%700 == 699:
new_ground.speed -= 1
gamespeed += 1
counter = (counter + 1)

if gameQuit:
break
while gameOver:
if pygame.display.get_surface() == None:
print("Couldn't load display surface")
gameQuit = True
gameOver = False
else:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameQuit = True
gameOver = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
gameQuit = True
gameOver = False
if event.key == pygame.K_RETURN or event.key == pygame.K_SPACE:
gameOver = False
gameplay()
highsc.update(high_score)
if pygame.display.get_surface() != None:
disp_gameOver_msg(retbutton_image,gameover_image)
if high_score != 0:
highsc.draw()
screen.blit(HI_image,HI_rect)
pygame.display.update()
clock.tick(FPS)

pygame.quit()
quit()

def main():
global isGameQuit
isGameQuit = introscreen()
if not isGameQuit:
gameplay()

main()


r/pythonhelp • • Oct 11 '22

How do I put a space between the rotated text and the edge of the bars?

0 Upvotes

How do I put a space between the rotated text and the edge of the bars?

Pic of Graph and Code