Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another Error message.
#1
This one is from an assignment using graphics.

POOL_BALL_RADIUS = 40
FONT_TYPE = "30pt Arial"


# Write your function here that draws a pool ball. (Make sure to use the correct name)
def draw_pool_ball(color,number,x,y):
    ball=Circle(POOL_BALL_RADIUS)
    ball.set_color(color)
    ball.set_position(x,y)
    add(ball)
    txt=Text(str(number)
    txt.set_position(x,y)
    txt.set_color(Color.white)
    txt.set_font(FONT_TYPE)
    add(num)


#function calls
draw_pool_ball(Color.orange, 5, 100, 100)
draw_pool_ball(Color.red, 3, 150, 350)
draw_pool_ball(Color.blue, 2, 250, 140)
draw_pool_ball(Color.green, 6, 50, 200)
Error:
Traceback (most recent call last): File __main__, line 13 txt.set_position(x,y) ^ SyntaxError: invalid syntax
Reply
#2
change

txt=Text(str(number)

to

txt=Text(str(number))
Reply
#3
(Mar-06-2023, 10:06 PM)Axel_Erfurt Wrote: change

txt=Text(str(number)

to

txt=Text(str(number))

thx
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error message about iid from RandomizedSearchCV Visiting 2 1,035 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,132 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  understanding error message krlosbatist 1 1,919 Oct-24-2021, 08:34 PM
Last Post: Gribouillis
  Error message pybits 1 42,175 May-29-2021, 10:26 AM
Last Post: snippsat
  f-string error message not understood Skaperen 4 3,360 Mar-16-2021, 07:59 PM
Last Post: Skaperen
  Overwhelmed with error message using pandas drop() EmmaRaponi 1 2,379 Feb-18-2021, 07:31 PM
Last Post: buran
  Winning/Losing Message Error in Text based Game kdr87 2 3,008 Dec-14-2020, 12:25 AM
Last Post: bowlofred
  Don't understand error message Milfredo 2 2,064 Aug-24-2020, 05:00 PM
Last Post: Milfredo
  what to do about this error message deric23 0 1,923 May-15-2020, 02:49 PM
Last Post: deric23
  pip error message Marijn 1 2,032 Apr-21-2020, 12:05 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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