ValueError: too many values to unpack (expected 2) error

Asked 1 years ago, Updated 1 years ago, 55 views

from Module import *
import turtle

inStr = ''
swidth, sheight = 500, 500
tX, tY, txtSize = [0] * 3


turtle.title ('writing')
turtle.shape('turtle')
turtle.setup(width = swidth + 50, height = sheight + 50)
turtle.screensize(swidth, sheight)
turtle.penup()

inStr=getString()

dist=100
angle=0
value = int(360 / len(inStr))

for ch in inStr:

    tX,tY = draw_Circle(angle,dist)

    r,g,b = getRGB()
    txtSize = 20

    turtle.goto(tX, tY)

    turtle.pencolor((r, g, b))
    turtle.write(ch,font = ('clear Gothic', txtSize, 'bold')

    angle += value

turtle.done()

Module part (I only showed you some of the error part!!!!!)

import math

def draw_Circle(angle,distance):
    rad = 3.14 * angle / 180
    tX = distance * math.cos(rad) 
    tY = distance * math.sin(rad) 
    return(rad, tX, tY)

Runtime

line 24, in <module>
    tX, tY = draw_Circle(angle,dist)
ValueError: too many values to unpack (expected 2)

This part tX,tY = draw_Circle(angle,dist) Or I think there's an error in the module@

python module

2022-09-20 22:08

1 Answers

draw_Circle returns a tuple with 3 values, but tX, tY = has only two variables.


2022-09-20 22:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.