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: 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 Tobiah




On 4/16/19 12:54 PM, fatima butt wrote:

[image: image.png]please I need help with IDLE teminal..its giving me error.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



Please copy the error text into your message.
The list won't accept attachments.


___
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-16 Thread Alan Gauld via Tutor
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] Fwd: IDLE Terminal

2019-04-16 Thread fatima butt
[image: image.png]please I need help with IDLE teminal..its giving me error.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor