Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Vulcans never bluff. -- Spock, "The Doomsday Machine", stardate 4202.1


devel / comp.lang.python / text displays on screen only when I click to exit the program

SubjectAuthor
o text displays on screen only when I click to exit the programQuentin Bock

1
text displays on screen only when I click to exit the program

<mailman.122.1619808968.3087.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12915&group=comp.lang.python#12915

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: qberz2...@gmail.com (Quentin Bock)
Newsgroups: comp.lang.python
Subject: text displays on screen only when I click to exit the program
Date: Fri, 30 Apr 2021 14:55:55 -0400
Lines: 66
Message-ID: <mailman.122.1619808968.3087.python-list@python.org>
References: <CAO9VG=gwyAXkWF7EP6xR7=tj9gYgAhvHNYz9bpKn2_GfU4Rtnw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de b65DKs+HwF/Qi6sEnfFddgfpKVCTQKHIO/8knc5XvGrg==
Return-Path: <qberz2005@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=I8ikYPR3;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'comments': 0.04; 'def':
0.04; 'pygame': 0.05; 'url:icon': 0.05; 'url:webmail': 0.05;
'loop': 0.07; 'subject:when': 0.07; 'window.': 0.09; 'tutorial':
0.12; 'import': 0.14; 'displays': 0.16; 'items,': 0.16; 'main()':
0.16; 'received:mail-yb1-xb33.google.com': 0.16; 'room,': 0.16;
'subject:program': 0.16; 'subject:screen': 0.16; 'python': 0.16;
'instructions': 0.20; 'url:utm_term': 0.23; 'to:addr:python-list':
0.23; 'code': 0.24; 'skip:p 30': 0.26; 'url:icon-envelope-tick-
round-orange-animated-no-repeat-v1': 0.26; 'url:sig-email': 0.27;
'virus-free.': 0.28; 'text': 0.29; 'there': 0.31; 'url:ipmcdn':
0.31; "doesn't": 0.32; 'window': 0.32; 'message-
id:@mail.gmail.com': 0.33; 'program': 0.33; 'url:link': 0.34;
'received:google.com': 0.34; 'running': 0.35; 'contains': 0.35;
'from:addr:gmail.com': 0.35; 'close': 0.36; 'url-
ip:104.85.5.152/32': 0.38; 'url-ip:23.66.18.80/32': 0.38; 'url-
ip:23.66.18/24': 0.38; 'event': 0.38; 'called': 0.40; 'url:avast':
0.40; 'advance': 0.60; 'items': 0.61; 'skip:w 10': 0.61;
'url:gif': 0.62; 'url:amp': 0.62; 'true': 0.63; 'later': 0.63;
'follow': 0.63; 'black': 0.64; 'picked': 0.65; 'global': 0.72;
'skip:f 20': 0.76; '"when': 0.84; 'subject:only': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:from:date:message-id:subject:to;
bh=nkASGg9Z/0k4TT7r+gZauEr3R9yasSjiA/Nx2uFrovE=;
b=I8ikYPR3WChD6MkpAGEHe3S33t92sZ/nVfTN4XOziwOCFIbRMqcP29uXTA/CLlYyse
8lAZjFZiGcr6dGuRAFbCgDG0mN3NdafRJqQCXVTjK8bsCtEoqdbA/PpNPrvMjQ+OO1Or
mq+kS3j0qb07UghiYSsAdSJtLrYhkXJuVr4wxpVsYrRWKMegsXLaOJq86LLWOIdzM4WK
JIT4am2XFBRszDgwz0CyMxh4RIjObNCF/FFrUEVnNrdViyiw3Sx12pCDgmBEZULoelMU
tcSSKfaoc3DDXbcsXOH2ndzVArXr2BKqMa0PhbfsfZZStux8rbNiyOsDrqte1UYjwjtR
Fztg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=nkASGg9Z/0k4TT7r+gZauEr3R9yasSjiA/Nx2uFrovE=;
b=e4KT3faEVWQzPppXkQczsjGhV7Ucc1By2r9mjoFYsIkAzgAgmCc9ttr07RM5vghNr4
3ideAofz7ora/hCiOn/b1oi6l5dXKYoCge0AvG+3reh8YZ3ua17FD3AhYxYXGIwheGAY
JL/22iVyCE/TCUPvb+4WUckMWblCiEttaFeFk5a1Iof7kS8IyZj3TMq26WMKpxYo5sNB
HovZoNFO3lD7In2ZA6Pve3HruYIAeRByF7h4zxsmZGMGgYB1ojf83E4YEMMsANwDXRxE
tTkE2/Z3SMCwFg97pmWDdCY+fxR5o3BsDSTvkBLdeduMb6FFT7sV+xNgqC0q8b6XDZPs
QdBQ==
X-Gm-Message-State: AOAM531xUdbhq2BQFZza1IGaysAl14gJdM28x25n+GfufklxPu7KpS4Q
mJD2v8nNDf7jHGs7/vMrlHv/nEPUM7daFHiviA1fMPgIdw4=
X-Google-Smtp-Source: ABdhPJzhS2Fh4XSvcZXnfh9td1PkTHNk73RxhdYaIldYETbSx75uHSidNSEvwnj7mubktBrkOYeIgWIU9skVCa4W13s=
X-Received: by 2002:a25:41d5:: with SMTP id o204mr8516249yba.384.1619808965437;
Fri, 30 Apr 2021 11:56:05 -0700 (PDT)
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAO9VG=gwyAXkWF7EP6xR7=tj9gYgAhvHNYz9bpKn2_GfU4Rtnw@mail.gmail.com>
 by: Quentin Bock - Fri, 30 Apr 2021 18:55 UTC

code with comments for context:

#Create a text based game where the user must find 3 items before
completing a level
#imports and variables for game
import pygame
from pygame import mixer
running = True
#initializes pygame
pygame.init()

#creates the pygame window
screen = pygame.display.set_mode((1200, 800))

#Title and Icon of window
pygame.display.set_caption("3.02 Project")
icon = pygame.image.load('3.02 icon.png')
pygame.display.set_icon(icon)

#setting up font
pygame.font.init()
font = pygame.font.Font('C:\Windows\Fonts\OCRAEXT.ttf', 16)
font_x = 10
font_y = 40
items_picked_up = 0
items_left = 3

#functions to be called later in program
def display_instruction(x, y):
instructions = font.render("Each level contains 3 items you must pick
up in each room."
"When you have picked up 3 items, you will
advance to the next room, there are 3 rooms.", True, (255, 255, 255))
screen.blit(instructions, (10, 40))

def main():
global running

#Game Loop
while running:
#sets screen color to black
screen.fill((0, 0, 0))

#checks if the user quits or exits the window
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False

display_instruction(font_x, font_y)
pygame.display.update()

main()

please excuse the def main() thing, this doesn't follow a tutorial this is
all on my own, and I don't know why the text displays when I close the
python window.
I appreciate all help :)

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


devel / comp.lang.python / text displays on screen only when I click to exit the program

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor