本文整理汇总了Python中turtle.clear函数的典型用法代码示例。如果您正苦于以下问题:Python clear函数的具体用法?Python clear怎么用?Python clear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tegnGitter
def tegnGitter(i0,i1,j0,j1):
"""Gitteret har søjler fra i0 til og med i1 og rækker fra
j0 til og med j1. Først blankstilles lærredet"""
xmin,ymin = toXY(i0,j0)
xlen,ylen = (i1-i0+2)*cs,(j1-j0+2)*cs
tt.clear()
tt.penup()
tt.color(kodefarve[4])
# vandrette linjer
x,y = xmin-cs/2,ymin
tt.setheading(0) # øst
for j in range(j0,j1+2):
tt.goto(x,y)
tt.pendown()
tt.forward(xlen)
tt.penup()
y += cs
# lodrette linjer
x,y = xmin,ymin-cs/2
tt.setheading(90) # nord
for i in range(i0,i1+2):
tt.goto(x,y)
tt.pendown()
tt.forward(ylen)
tt.penup()
x += cs
示例2: alpha_beta_helper
def alpha_beta_helper():
global state, root, alpha_time
initialize()
print("PLEASE WAIT!!!")
root = TreeNode(-1000)
time1 = time.time()
alpha_beta(root, 1, state)
init_screen()
drawLine()
drawGrid()
drawColumns()
drawRows()
caliberate()
col = root.ans
row = -1
turtle.onscreenclick(goto)
for i in range(4):
if state[i][col] == 0:
row = i
break
state[row][col] = 1
drawDot(row, col, 1)
var = (int)(input("Enter 1 to continue playing or 0 to stop."))
time2 = time.time()
alpha_time = time2-time1
if(var == 1):
turtle.clear()
turtle.goto(0, 0)
turtle.penup()
turtle.right(270)
alpha_beta_helper()
else:
write_analysis(3)
示例3: main
def main():
ap = ArgumentParser()
ap.add_argument('--speed', type=int, default=10,
help='Number 1-10 for drawing speed, or 0 for no added delay')
ap.add_argument('program')
args = ap.parse_args()
for kind, number, path in parse_images(args.program):
title = '%s #%d, path length %d' % (kind, number, path.shape[0])
print(title)
if not path.size:
continue
pen_up = (path==0).all(axis=1)
# convert from path (0 to 65536) to turtle coords (0 to 655.36)
path = path / 100.
turtle.title(title)
turtle.speed(args.speed)
turtle.setworldcoordinates(0, 655.36, 655.36, 0)
turtle.pen(shown=False, pendown=False, pensize=10)
for i,pos in enumerate(path):
if pen_up[i]:
turtle.penup()
else:
turtle.setpos(pos)
turtle.pendown()
turtle.dot(size=10)
_input('Press enter to continue')
turtle.clear()
turtle.bye()
示例4: display
def display(self):
turtle.clear()
# draws all live cells from grid.state
for i in range(self.xspan):
for j in range(self.yspan):
self.draw(i, j)
turtle.update()
示例5: nextGeneration
def nextGeneration(self, step=True):
self.refreshCanvas()
self.dirty = True
turtle.TurtleScreen._RUNNING = True
self.screen.clear()
self.screen.mode("standard")
self.state = RUNNING
self.selected = []
self.configGUI(DISABLED, DISABLED, DISABLED, DISABLED, NORMAL, DISABLED,
"Drawing, please wait...", "red")
if step:
self.ge.set_fitnesses(self.fitness)
self.ge.step()
self.myt = MyTurtle(650, 650, 3, 3)
turtle.clear()
for i in range(self.n):
for j in range(self.m):
self.setUnselected(i, j)
#Drawing l-system
# phenotype = 'angle=6%d\ndepth=%d\nstep_size=10\ncircle_angle=20.5\naxiom=F\nF=F-F++F-F'%((i*j),(i*j))
phenotype = self.ge.individuals[i*self.n+j].phenotype
valid = self.draw_phenotype(
phenotype,
self.myt.index_to_pixel(i, "x") + self.myt.xside_box / 2.0,
self.myt.index_to_pixel(j, "y") + self.myt.yside_box / 2.0,
self.myt.xside,
self.myt.yside)
if not valid:
self.setInvalid(i, j)
self.configGUI(NORMAL, NORMAL, NORMAL, NORMAL, DISABLED, DISABLED, INSTRUCTIONS)
self.set_listeners()
示例6: draw_l
def draw_l(word):
turtle.up()
turtle.clear()
turtle.setposition(0, 0)
turtle.setheading(0)
turtle.bk(INITIAL_POS[0])
turtle.down()
turtle.st()
stack = []
for char in word:
if char == '0':
turtle.fd(SIZE[0])
if char == '1':
turtle.fd(SIZE[0])
if char == '[':
stack.append((turtle.position(), turtle.heading()))
turtle.lt(45)
if char == ']':
position, heading = stack.pop()
turtle.up()
turtle.setposition(position)
turtle.setheading(heading)
turtle.rt(45)
turtle.down()
turtle.ht()
示例7: Run
def Run():
#bounds
nearRange = [0, 50]
farRange = [50, 200]
frusHL = 100
#Logic
nearDist = random.uniform(nearRange[0], nearRange[1])
farDist = random.uniform(farRange[0], farRange[1])
d = frusHL * 2
an = nearDist
af = farDist
b = (d*d + af*af - an*an) / (2 * d)
radius = math.sqrt(b*b + an*an)
originY = -frusHL + b
#text.insert('end', 'Origin: %d\n' % originY)
#Render
turtle.clear()
turtle.hideturtle()
turtle.tracer(0, 0)
turtle.penup()
turtle.goto(-farDist, frusHL)
turtle.pendown()
turtle.goto(-nearDist, -frusHL)
turtle.goto(nearDist, -frusHL)
turtle.goto(farDist, frusHL)
turtle.goto(-farDist, frusHL)
turtle.penup()
DrawCircle(0, originY, radius);
turtle.update()
示例8: message
def message(m1, m2): # 메시지를 화면에 표시하는 함수
t.clear()
t.goto(0, 100)
t.write(m1, False, "center", ("", 20))
t.goto(0, -100)
t.write(m2, False, "center", ("", 15))
t.home()
示例9: animate_fw
def animate_fw(slide1, slide2):
for i in range(100):
turtle.clear()
draw_slide(slide1[0],slide1[1],-885+(i*8.85),0)
draw_slide(slide2[0],slide2[1],i*8.85,0)
turtle.update()
return
示例10: loop
def loop(x,y):
if -50<x<50 and -5<y<45:
turtle.clear()
play()
else:
turtle.showturtle()
turtle.goto(x, y)
示例11: display
def display(self):
"""Draw the whole board"""
turtle.clear()
for i in range(self.xsize):
for j in range(self.ysize):
self.draw(i, j)
turtle.update()
示例12: main
def main(x,y):
turtle.clear();
j();
a();
z();
d();
e();
e();
p();
示例13: cleargraph
def cleargraph():
global outwin
try:
outwin.destroy()
except:
None
turtle.clear()
gridlines(True)
return
示例14: keys
def keys():
turtle.clear()
turtle.speed(0)
turtle.pencolor("black")
turtle.pu()
paint (-250,325)
turtle.goto(0,0)
turtle.pd()
turtle.speed(9)
pensize=5
示例15: main
def main(loop_on, dots):
#dots = int(input("How many dots? "))
while loop_on:
turtle_setup()
draw_random_dots(dots)
turtle.clear()
print("")
if not loop_on:
turtle_setup()
draw_random_dots(dots)