python 图形化 无响应_Turtle图形窗口没有响应

我正在尝试将我之前制作的Julia集生成器转换为Python代码。但是,当代码运行时,turtle图形窗口会立即停止响应,并且不会绘制任何内容。我做了什么可怕的错误,还是我遗漏了什么?也许我对python的要求太高了,不能在1帧内完成。请解释是什么导致了这种情况,以及我如何解决它。谢谢!在import turtle

import time

y_set = []

map_output = 0

iterations = 0

#turtle.hideturtle()

#turtle.speed(1)

生成y值列表

^{pr2}$

创建颜色值def color (i, n):

output = map(i, 2, 10000, 0, 2500)

if output < 0:

output = 0

if output > 0:

output = 255

在x上迭代def repeat (n, r, i):

global iterations

global x

global y

aa = 0

ba = 0

ab = 0

a = 0

b = 0

for j in range (n):

iterations += 1

aa = a * a

bb = b * b

ab = 2 * a * b

a = ((aa - bb) + float(r))

b = (ab + float(i))

if (ab + bb) > 4:

break

turtle.setx(100 * x)

turtle.sety(100 * y)

color(iterations, n)

turtle.pendown()

turtle.penup()

在y上迭代def Julia (s, r, i, d):

global iterations

global y_set

global x

global y

global a

global b

y_set(s)

while len(y_set) > 0:

y = y_set[0]/360

del y_set[0]

x = -1.5

for n in range (round((700/(float(r)+1))+1)):

a = x

b = y

iterations = 0

repeat(10**d, r, i)

x += ((1/240)*s)

用户输入real = input('Real: ')

imag = input('Imaginary: ')

Julia (1, real, imag, 100)

turtle.done()

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值