Re: [Tutor] Fwd: IDLE Terminal

2019-04-17 Thread fatima butt
hi
the python version is 3.7.3
computer is acer SWIFT
The error I get is following:
Traceback (most recent call last):
  File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 84,
in 
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
pygame.error: Couldn't open
C:\Users\ammah\OneDrive\Documents\project1\ship1.jpg
>>>

The code that I entered in my Python shell is as following:
# Pygame template - skeleton for a new pygame project
import pygame
import random
from os import path

img_dir = path.dirname(__file__)


WIDTH = 480
HEIGHT = 600
FPS = 60

# define colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255,255,0)

pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()


class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((80,70))
self.image.fill(GREEN)
self.rect =self.image.get_rect()
self.rect.centerx = WIDTH / 2
self.rect.bottom = HEIGHT -10
self.speedx = 0

def update(self):
self.speedx = 0
keystate = pygame.key.get_pressed()
if keystate[pygame.K_LEFT]:
self.speedx = 5
if keystate[pygame.K_RIGHT]:
self.speedx = -5
self.rect.x += self.speedx

def shoot(self):
bullet = Bullet(self.rect.centerx, self.rect.top)
all_sprites.add(bullet)
bullets.add(bullet)

class Mob(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface ((40,30))
self.image.fill(RED)
self.rect = self.image.get_rect()
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-100,-40)
self.speedy=random.randrange(1,8)

def update(self):
self.rect.y += self.speedy
if self.rect.top > HEIGHT +10:
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-100,-40)
self.speedy=random.randrange(1,8)

class Bullet(pygame.sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((10,20))
self.image.fill(YELLOW)
self.rect = self.image.get_rect()
self.rect.bottom = y
self.rect.centerx = x
self.speedy = -10

def update(self):
self.rect.y += self.speedy
if self.rect.bottom<0:
self.kill()

#Load all game graphics
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
background_rect = background.get_rect()



all_sprites = pygame.sprite.Group()
mobs = pygame.sprite.Group()
bullets = pygame.sprite.Group()
player = Player()
all_sprites.add(player)
for i in range(8):
m = Mob()
all_sprites.add(m)
mobs.add(m)
# Game loop
running = True
while running:
# keep loop running at the right speed
clock.tick(FPS)
# Process input (events)
for event in pygame.event.get():
# check for closing window
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
player.shoot()
# Update
all_sprites.update()
#check to see if a bullet hit a mob
#check to see if a mob hit the player
hits = pygame.sprite.spritecollide(player,mobs,False)
if hits:
running = False

# Draw / render
screen.fill(BLACK)
screen.blit(background, background_rect)
all_sprites.draw(screen)
# *after* drawing everything, flip the display
pygame.display.flip()

pygame.quit()



On Tue, 16 Apr 2019 at 23:40, Alan Gauld via Tutor  wrote:

> On 16/04/2019 20:54, fatima butt wrote:
> > [image: image.png]please I need help with IDLE teminal..its giving me
> error.
>
> The mail server drops attachments because they are a potential
> security threat.
>
> Please post the error text (cut 'n paste if possible)
> Also describe what you are trying to do.
> Which OS you are using and which Python version.
> The more detail you give s the easier it is to give
> you the correct answer.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: IDLE Terminal

2019-04-17 Thread fatima butt
Its IDLE python version 3.7.3
ITs Subprocess Startup Error.
IDLE startupprocess didnt make connection.Either IDLE cant start a process
or personal firewall software is blocking the connection.

the computer i am using is swift acer


On Tue, 16 Apr 2019 at 23:40, Alan Gauld via Tutor  wrote:

> On 16/04/2019 20:54, fatima butt wrote:
> > [image: image.png]please I need help with IDLE teminal..its giving me
> error.
>
> The mail server drops attachments because they are a potential
> security threat.
>
> Please post the error text (cut 'n paste if possible)
> Also describe what you are trying to do.
> Which OS you are using and which Python version.
> The more detail you give s the easier it is to give
> you the correct answer.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: uploading images in pygame

2019-04-17 Thread fatima butt
the python version is 3.7.3
computer is acer SWIFT
The error I get is following:
Traceback (most recent call last):
  File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py
", line 84, in 
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
pygame.error: Couldn't open
C:\Users\ammah\OneDrive\Documents\project1\ship1.jpg
>>>

The code that I entered in my Python shell is as following:
# Pygame template - skeleton for a new pygame project
import pygame
import random
from os import path

img_dir = path.dirname(__file__)


WIDTH = 480
HEIGHT = 600
FPS = 60

# define colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255,255,0)

pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()


class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((80,70))
self.image.fill(GREEN)
self.rect =self.image.get_rect()
self.rect.centerx = WIDTH / 2
self.rect.bottom = HEIGHT -10
self.speedx = 0

def update(self):
self.speedx = 0
keystate = pygame.key.get_pressed()
if keystate[pygame.K_LEFT]:
self.speedx = 5
if keystate[pygame.K_RIGHT]:
self.speedx = -5
self.rect.x += self.speedx

def shoot(self):
bullet = Bullet(self.rect.centerx, self.rect.top)
all_sprites.add(bullet)
bullets.add(bullet)

class Mob(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface ((40,30))
self.image.fill(RED)
self.rect = self.image.get_rect()
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-100,-40)
self.speedy=random.randrange(1,8)

def update(self):
self.rect.y += self.speedy
if self.rect.top > HEIGHT +10:
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-100,-40)
self.speedy=random.randrange(1,8)

class Bullet(pygame.sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((10,20))
self.image.fill(YELLOW)
self.rect = self.image.get_rect()
self.rect.bottom = y
self.rect.centerx = x
self.speedy = -10

def update(self):
self.rect.y += self.speedy
if self.rect.bottom<0:
self.kill()

#Load all game graphics
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
background_rect = background.get_rect()



all_sprites = pygame.sprite.Group()
mobs = pygame.sprite.Group()
bullets = pygame.sprite.Group()
player = Player()
all_sprites.add(player)
for i in range(8):
m = Mob()
all_sprites.add(m)
mobs.add(m)
# Game loop
running = True
while running:
# keep loop running at the right speed
clock.tick(FPS)
# Process input (events)
for event in pygame.event.get():
# check for closing window
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
player.shoot()
# Update
all_sprites.update()
#check to see if a bullet hit a mob
#check to see if a mob hit the player
hits = pygame.sprite.spritecollide(player,mobs,False)
if hits:
running = False

# Draw / render
screen.fill(BLACK)
screen.blit(background, background_rect)
all_sprites.draw(screen)
# *after* drawing everything, flip the display
pygame.display.flip()

pygame.quit()


On Tue, 16 Apr 2019 at 23:34, Alan Gauld via Tutor  wrote:

> On 16/04/2019 20:54, fatima butt wrote:
> > please i am getting error..
>
> Hi, we need to be quite specific here about the details
> because it is not clear exactly what you are trying to do.
>
> > i am trying to upload image from openspaceart
> > from internet .
>
> Just to be clear.
> Uploading means going from your computer onto a server
> on the internet. So, I'm assuming what you are trying
> to do is download an image from openspaceart to your
> computer. Is that correct?
>
> Or are you in fact trying to upload an image from your
> computer to the openspaceart server?
>
> There is a big difference between the two.
>
> > I have downloaded the image on my desktop
>
> So it sounds like you have succeeded in downloading
> the image from the server and now have a copy on
> your local computer? Is that correct?
>
> > and i am trying
> > to upload this to the pygame.
>
> But pygame is not on a network it is on your computer
> so you don't need to upload the image, you should
> just need to access it from within pygame.
>
> To help with that we need to know exactly what you
> are trying to do

Re: [Tutor] Fwd: uploading images in pygame

2019-04-17 Thread Peter Otten
fatima butt wrote:

> the python version is 3.7.3
> computer is acer SWIFT
> The error I get is following:
> Traceback (most recent call last):
>   File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py
> ", line 84, in 
> background =
> pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
> pygame.error: Couldn't open
> C:\Users\ammah\OneDrive\Documents\project1\ship1.jpg

Are you sure you have an image called 'ship1.jpg' in the
"C:\Users\ammah\OneDrive\Documents\project1" folder?

Double-check before you take other less likely problems into consideration.

If you can see the above file in your filemanager -- does the following 
script succeed?

with open(r"C:\Users\ammah\OneDrive\Documents\project1"), "rb"):
pass

If it doesn't, what does the traceback show?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: uploading images in pygame

2019-04-17 Thread Alan Gauld via Tutor
On 17/04/2019 10:14, fatima butt wrote:
> the python version is 3.7.3
> computer is acer SWIFT
> The error I get is following:
> Traceback (most recent call last):
>   File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py
> ", line 84, in 
> background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
> pygame.error: Couldn't open
> C:\Users\ammah\OneDrive\Documents\project1\ship1.jpg

In addition to checking that the file exists in that location
you should also check the permissions to make sure you are
allowed to open it.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Off-Topic: Tutor group specific to Java

2019-04-17 Thread Karthik Bhat
Hello Guys,
This is kind of off-topic, but I would really appreciate it if
anyone could provide me with a tutor mailing list/group specific to Java.
I am a beginner, and it would be really helpful for me.

-- 
Thanks & Regards,
Karthik A Bhat
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Help

2019-04-17 Thread fatima butt
hi Peter,
hope you are well.I am getting the following error when i am running the pygame 
shell script.I am using Acer SWIFT computer.my python version is 3.7.3 and 
pygame version is pygame 1.9.5

Traceback (most recent call last):
  File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 166, in 

draw_text(screen, str(score),18, WIDTH/2,10)
  File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 28, in 
draw_text
font = pygame.font.Font(font_name, size)
pygame.error: font not initialized
>>> 

my code is as following:
# Pygame template - skeleton for a new pygame project
import pygame
import random
from os import path

img_dir = path.dirname(__file__)


WIDTH = 480
HEIGHT = 600
FPS = 60

# define colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255,255,0)

pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()

font_name = pygame.font.match_font('arial')
def draw_text(surf, text, size, x, y):
font = pygame.font.Font(font_name, size)
text_surface = font.render(text, True, WHITE)
text_rect = text.surface.get_rect()
text_rect.midtop =(x,y)
surf.blit(text_surface, text_rect)

class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.transform.scale(player_img,(50,38))
self.image.set_colorkey(BLACK)
self.rect =self.image.get_rect()
self.radius = 20
#pygame.draw.circle(self.image, RED,self.rect.center, self.radius)
self.rect.centerx = WIDTH / 2
self.rect.bottom = HEIGHT -10
self.speedx = 0

def update(self):
self.speedx = 0
keystate = pygame.key.get_pressed()
if keystate[pygame.K_LEFT]:
self.speedx = 5
if keystate[pygame.K_RIGHT]:
self.speedx = -5
self.rect.x += self.speedx

def shoot(self):
bullet = Bullet(self.rect.centerx, self.rect.top)
all_sprites.add(bullet)
bullets.add(bullet)

class Mob(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image_orig = meteor_img
self.image_orig = random.choice(meteor_images)
self.image_orig.set_colorkey(BLACK)
self.image = self.image_orig.copy()
self.rect = self.image.get_rect()
self.radius = int(self.rect.width *.9 / 2)
#pygame.draw.circle(self.image, RED,self.rect.center, self.radius)
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-150,-100)
self.speedy=random.randrange(1,8)
self.speedx=random.randrange(-3,3)
self.rot = 0
self.rot_speed = random.randrange(-8,8)
self.last_update = pygame.time.get_ticks()

def rotate(self):
now = pygame.time.get_ticks()
if now - self.last_update > 50:
self.last_update = now
self.rot = (self.rot + self.rot_speed) % 360
new_image = pygame.transform.rotate(self.image_orig, self.rot)
old_center = self.rect.center
self.image = new_image
self.rect = self.image.get_rect()
self.rect.center = old_center

def update(self):
self.rotate()
self.rect.x += self.speedx
self.rect.y += self.speedy
if self.rect.top > HEIGHT +10:
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-100,-40)
self.speedy=random.randrange(1,8)

class Bullet(pygame.sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self)
self.image = bullet_img
self.image.set_colorkey(BLACK)
self.rect = self.image.get_rect()
self.rect.bottom = y
self.rect.centerx = x
self.speedy = -10

def update(self):
self.rect.y += self.speedy
if self.rect.bottom<0:
self.kill()

#Load all game graphics
background = pygame.image.load(path.join(img_dir,"purple.png")).convert()
background_rect = background.get_rect()
player_img = 
pygame.image.load(path.join(img_dir,"playerShip1_blue.png")).convert()
meteor_img = 
pygame.image.load(path.join(img_dir,"meteorBrown_big1.png")).convert()
bullet_img = pygame.image.load(path.join(img_dir,"laserGreen01.png")).convert()
meteor_images = []
meteor_list = 
['meteorBrown_big1.png','meteorBrown_big2.png','meteorBrown_med1.png',
   
'meteorBrown_med1.png','meteorBrown_small1.png','meteorBrown_small2.png',
   'meteorBrown_big1.png']
for img in meteor_list:
meteor_images.append(pygame.image.load(path.join(img_dir,img)).convert())
all_sprites = pygame.sprite.Group()
mobs = pygame.sprite.Group()
bullets = pygame.sprite.Group()
player = Player()
all_sprites.add(player)
for i in range(8):
m 

[Tutor] Help

2019-04-17 Thread fatima butt
hi Peter,
hope you are well.I am getting the following error when i am running the pygame 
shell script.I am using Acer SWIFT computer.my python version is 3.7.3 and 
pygame version is pygame 1.9.5

Traceback (most recent call last):
  File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 166, in 

draw_text(screen, str(score),18, WIDTH/2,10)
  File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 28, in 
draw_text
font = pygame.font.Font(font_name, size)
pygame.error: font not initialized
>>> 

my code is as following:
# Pygame template - skeleton for a new pygame project
import pygame
import random
from os import path

img_dir = path.dirname(__file__)


WIDTH = 480
HEIGHT = 600
FPS = 60

# define colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255,255,0)

pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()

font_name = pygame.font.match_font('arial')
def draw_text(surf, text, size, x, y):
font = pygame.font.Font(font_name, size)
text_surface = font.render(text, True, WHITE)
text_rect = text.surface.get_rect()
text_rect.midtop =(x,y)
surf.blit(text_surface, text_rect)

class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.transform.scale(player_img,(50,38))
self.image.set_colorkey(BLACK)
self.rect =self.image.get_rect()
self.radius = 20
#pygame.draw.circle(self.image, RED,self.rect.center, self.radius)
self.rect.centerx = WIDTH / 2
self.rect.bottom = HEIGHT -10
self.speedx = 0

def update(self):
self.speedx = 0
keystate = pygame.key.get_pressed()
if keystate[pygame.K_LEFT]:
self.speedx = 5
if keystate[pygame.K_RIGHT]:
self.speedx = -5
self.rect.x += self.speedx

def shoot(self):
bullet = Bullet(self.rect.centerx, self.rect.top)
all_sprites.add(bullet)
bullets.add(bullet)

class Mob(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image_orig = meteor_img
self.image_orig = random.choice(meteor_images)
self.image_orig.set_colorkey(BLACK)
self.image = self.image_orig.copy()
self.rect = self.image.get_rect()
self.radius = int(self.rect.width *.9 / 2)
#pygame.draw.circle(self.image, RED,self.rect.center, self.radius)
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-150,-100)
self.speedy=random.randrange(1,8)
self.speedx=random.randrange(-3,3)
self.rot = 0
self.rot_speed = random.randrange(-8,8)
self.last_update = pygame.time.get_ticks()

def rotate(self):
now = pygame.time.get_ticks()
if now - self.last_update > 50:
self.last_update = now
self.rot = (self.rot + self.rot_speed) % 360
new_image = pygame.transform.rotate(self.image_orig, self.rot)
old_center = self.rect.center
self.image = new_image
self.rect = self.image.get_rect()
self.rect.center = old_center

def update(self):
self.rotate()
self.rect.x += self.speedx
self.rect.y += self.speedy
if self.rect.top > HEIGHT +10:
self.rect.x =random.randrange(WIDTH-self.rect.width)
self.rect.y=random.randrange(-100,-40)
self.speedy=random.randrange(1,8)

class Bullet(pygame.sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self)
self.image = bullet_img
self.image.set_colorkey(BLACK)
self.rect = self.image.get_rect()
self.rect.bottom = y
self.rect.centerx = x
self.speedy = -10

def update(self):
self.rect.y += self.speedy
if self.rect.bottom<0:
self.kill()

#Load all game graphics
background = pygame.image.load(path.join(img_dir,"purple.png")).convert()
background_rect = background.get_rect()
player_img = 
pygame.image.load(path.join(img_dir,"playerShip1_blue.png")).convert()
meteor_img = 
pygame.image.load(path.join(img_dir,"meteorBrown_big1.png")).convert()
bullet_img = pygame.image.load(path.join(img_dir,"laserGreen01.png")).convert()
meteor_images = []
meteor_list = 
['meteorBrown_big1.png','meteorBrown_big2.png','meteorBrown_med1.png',
   
'meteorBrown_med1.png','meteorBrown_small1.png','meteorBrown_small2.png',
   'meteorBrown_big1.png']
for img in meteor_list:
meteor_images.append(pygame.image.load(path.join(img_dir,img)).convert())
all_sprites = pygame.sprite.Group()
mobs = pygame.sprite.Group()
bullets = pygame.sprite.Group()
player = Player()
all_sprites.add(player)
for i in range(8):
m 

Re: [Tutor] Off-Topic: Tutor group specific to Java

2019-04-17 Thread Alan Gauld via Tutor
On 17/04/2019 16:29, Karthik Bhat wrote:
> This is kind of off-topic, but I would really appreciate it if
> anyone could provide me with a tutor mailing list/group specific to Java.
> I am a beginner, and it would be really helpful for me.

While thee are similar groups for some other languages I've never
found anything similar for Java (or C++ for that matter).

The best I can suggest is asking on stack Overflow, just be sure to
follow the guidelines for asking good questions to avoid flack.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help

2019-04-17 Thread Peter Otten
fatima butt wrote:

> hi Peter,
> hope you are well.I am getting the following error when i am running the
> pygame shell script.I am using Acer SWIFT computer.my python version is
> 3.7.3 and pygame version is pygame 1.9.5
> 
> Traceback (most recent call last):
>   File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line
>   166, in 
> draw_text(screen, str(score),18, WIDTH/2,10)
>   File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 28,
>   in draw_text
> font = pygame.font.Font(font_name, size)
> pygame.error: font not initialized

OK, you now have a different script, with a different error. Does that mean 
you resolved your previous problem?

Fine.

Regarding the new error I found the following hint

https://stackoverflow.com/questions/28517979/pygame-font-error

i. e. use 

pygame.init()

by entering the error message into a popular search engine ;)

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor