Python Forum
Beginner stuck in Python book for kids
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner stuck in Python book for kids
#11
(Nov-22-2023, 12:22 PM)menator01 Wrote: This worked for me
  • python3 -m pip install pgzero
  • created blank file intro.py
  • created a function called draw
  • ran from terminal pgzrun intro.py

def draw():
    screen.draw.text('Hello World!', (120,120), color='orange', fontsize=48)
Using IDLE or other IDEs
import pgzrun

def draw():
    screen.draw.text('Hello World!', (120,120), color='orange', fontsize=48)

pgzrun.go()
Output:



I can recreate your file too now, with IDLE. So I guess I can at least continue with the book, though there's an instruction there that somehow just doesn't work for me. Maybe I'll understand what's wrong some day.
Thank you very much for your time Smile

Attached Files

Thumbnail(s)
   
Reply
#12
When you run Python program by double clicking, the default is to open a python shell to run the program. If the program creates a window you end up with two windows. You can prevent the python shell window from appearing by changing the python file extension from .py to .pyw, There may be several differences between what you see and what happens on you windows computer. Python on linux or macos run different than windows.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Deitel book "Python for Programmers" ricardian 7 23,339 May-12-2023, 01:33 PM
Last Post: snippsat
  best " Learning Python " book for a beginner alok 4 3,067 Jul-30-2021, 11:37 AM
Last Post: metulburr
  Nested Python functions (Dan Bader's book) Drone4four 4 2,586 Jun-26-2021, 07:54 AM
Last Post: ndc85430
  I really need help, I am new to python, I am using a book that helps me to learn JaprO 5 2,999 Nov-28-2020, 02:30 PM
Last Post: JaprO
  Stuck on python quiz challenge baesian 2 2,195 Aug-16-2020, 12:52 AM
Last Post: scidam
  creating an 'adress book' in python using dictionaries? apollo 6 14,837 May-06-2019, 12:03 PM
Last Post: snippsat
  Learning python, stuck on some code. stanceworksv8 2 3,495 Apr-02-2019, 01:51 AM
Last Post: stanceworksv8
  I'm teaching myself python and i'm stuck... stormrider 2 3,019 Dec-06-2017, 10:16 PM
Last Post: Larz60+
  I finsh the basics of python but I'm stuck on how to link code to GUI Qubayel 5 4,361 Apr-04-2017, 07:18 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

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