本文整理汇总了Python中turtle.getscreen函数的典型用法代码示例。如果您正苦于以下问题:Python getscreen函数的具体用法?Python getscreen怎么用?Python getscreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getscreen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: drawWith
def drawWith(self, turtle):
self.height = turtle.getscreen().window_height()
self.width = turtle.getscreen().window_width()
for drawableObject in self.drawableObjects:
drawableObject.draw(turtle)
turtle.getscreen().update()
开发者ID:glutzic,项目名称:bob,代码行数:7,代码来源:neural2.py
示例2: funcion
def funcion(numero, diametro):
t=turtle.Pen()
angulo=360/numero
for x in range (1,numero+1):
t.forward(diametro)
t.left(angulo)
turtle.getscreen()._root.mainloop()
开发者ID:KarlaSteff,项目名称:Semana-9-,代码行数:7,代码来源:Ejercicio9.py
示例3: graficarFigura
def graficarFigura():
t=turtle.Pen()
angulo = (180/lados)+180
t.pencolor("red")
for x in range(0,lados):
t.forward(250)
t.right(angulo)
turtle.getscreen()._root.mainloop()
开发者ID:jcrcsh,项目名称:Deber-Calse9,代码行数:8,代码来源:nlados.py
示例4: draw_square
def draw_square(x,y):
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.goto(x+50,y)
turtle.goto(x+50,y+50)
turtle.goto(x,y+50)
turtle.goto(x,y)
turtle.getscreen().onkeypress(draw_square, "s")
turtle.getscreen().listen()
开发者ID:dania16-meet,项目名称:MEET-YL1,代码行数:10,代码来源:meetconf.py
示例5: drawcurve
def drawcurve(points):
myTurtle = turtle.Turtle(shape="turtle")
turtle.screensize(500,500)
turtle.setworldcoordinates(400,400,500,500)
myTurtle.penup()
y = points[0]
myTurtle.setposition(y[0], y[1])
myTurtle.pendown()
for x in points:
myTurtle.setposition(x[0], x[1])
turtle.getscreen()._root.mainloop()
开发者ID:mmercedes,项目名称:18-549,代码行数:11,代码来源:pi2c.py
示例6: main
def main():
turtle.colormode(1.)
turtle.speed(0)
for depth in range(9):
if 7 > depth > 4: # for faster rendering.
turtle.getscreen().tracer(0)
global count
count = 0
hilbert(0.0, 0.0, 1.0, 0.0, 0.0, 1.0, depth)
turtle.getscreen().tracer(1)
#time.sleep(2)
turtle.Screen().exitonclick()
开发者ID:tthtlc,项目名称:sansagraphics,代码行数:12,代码来源:hilbert2d.py
示例7: setup
def setup(col, x, y, w, s, shape):
turtle.up()
turtle.goto(x,y)
turtle.width(w)
turtle.turtlesize(s)
turtle.color(col)
turtle.shape(shape)
turtle.bgpic("assets/dancing-banana.gif")
turtle.down()
wn.listen()
turtle.getscreen()._root.bind_all('<Key>', key_pressed)
turtle.getscreen()._root.mainloop()
开发者ID:kabinud,项目名称:FunPython,代码行数:12,代码来源:turtle_setup.py
示例8: initialize_plot
def initialize_plot(self, positions):
self.positions = positions
self.minX = minX = min(x for x,y in positions.values())
maxX = max(x for x,y in positions.values())
minY = min(y for x,y in positions.values())
self.maxY = maxY = max(y for x,y in positions.values())
ts = turtle.getscreen()
if ts.window_width > ts.window_height:
max_size = ts.window_height()
else:
max_size = ts.window_width()
self.width, self.height = max_size, max_size
turtle.setworldcoordinates(minX-5,minY-5,maxX+5,maxY+5)
turtle.setup(width=self.width, height=self.height)
turtle.speed("fastest") # important! turtle is intolerably slow otherwise
turtle.tracer(False) # This too: rendering the 'turtle' wastes time
turtle.hideturtle()
turtle.penup()
self.colors = ["#d9684c","#3d658e","#b5c810","#ffb160","#bd42b3","#0eab6c","#1228da","#60f2b7" ]
for color in self.colors:
s = turtle.Shape("compound")
poly1 = ((0,0),(self.cell_size,0),(self.cell_size,-self.cell_size),(0,-self.cell_size))
s.addcomponent(poly1, color, "#000000")
turtle.register_shape(color, s)
s = turtle.Shape("compound")
poly1 = ((0,0),(self.cell_size,0),(self.cell_size,-self.cell_size),(0,-self.cell_size))
s.addcomponent(poly1, "#000000", "#000000")
turtle.register_shape("uncolored", s)
开发者ID:jorgenkg,项目名称:IT3105,代码行数:34,代码来源:visuals.py
示例9: drawcicle
def drawcicle(noOfInterface,val):
tlist = list()
screen = turtle.getscreen()
screen.tracer(0)
for i in range(noOfInterface):
tlist.append(turtle.Turtle())
tlist[i].up()
tlist[i].back(val)
tlist[i].left(90)
tlist[i].forward(200-(10+90*i))
tlist[i].begin_fill()
tlist[i].down()
tlist[i].circle(15)
tlist[i].end_fill()
tlist[i].hideturtle()
for i in range(noOfInterface):
turt = turtle.Turtle()
turt.up()
turt.back(val-300)
turt.left(90)
turt.forward(200-(10+90*i))
turt.begin_fill()
turt.down()
turt.circle(15)
turt.end_fill()
turt.hideturtle()
screen.update()
开发者ID:harisphnx,项目名称:networking,代码行数:27,代码来源:newPim_work.py
示例10: main
def main():
file_name = "go"
file_name = raw_input( 'Enter a file name or exit to quit program: ')
while (file_name != "exit" and file_name != "Exit" and file_name != "quit" and file_name != "Quit"):
f = open( file_name, 'r' )
first_line = f.readline()
first_line = first_line.split()
distance = float( first_line[0] )
angle = float( first_line[1] )
stack = []
wn = tur.Screen()
for line in f:
wn.clear()
tur.penup()
tur.seth(90)
tur.setx(0)
tur.sety(-200)
tur.pendown()
interprit_line(tur, line, angle, distance, stack)
ts = tur.getscreen()
ts.getcanvas().postscript(file=file_name +".eps")
wn.exitonclick()
file_name = raw_input( 'Enter a file name or exit to quit program: ')
开发者ID:CsmithSD,项目名称:SimulationHW,代码行数:31,代码来源:turtle_ol.py
示例11: a
def a(fill=False):
'''draws a capital A.'''
turtle.setheading(0)
if fill: bf()
fd(10)
turtle.goto(turtle.xcor() + 5, turtle.ycor() + 40)
fd(10)
turtle.goto(turtle.xcor() + 5, turtle.ycor() - 40)
fd(10)
turtle.goto(turtle.xcor() - 15, turtle.ycor() + 110)
turtle.setx(turtle.xcor() - 10)
turtle.goto(turtle.xcor() - 15, turtle.ycor() - 110)
if fill: ef()
pu()
turtle.goto(turtle.xcor() + 17, turtle.ycor() + 50)
pd()
if fill:
cfc = fc()
fc(turtle.getscreen().bgcolor())
bf()
fd(6)
turtle.goto(turtle.xcor() - 3, turtle.ycor() + 40)
turtle.goto(turtle.xcor() - 3, turtle.ycor() - 40)
if fill:
ef()
fc(cfc)
pu()
turtle.goto(turtle.xcor() + 33, turtle.ycor() - 50)
pd()
开发者ID:BoroDojo,项目名称:borodojo-python,代码行数:29,代码来源:fredx.py
示例12: draw
def draw(x,y,count,isGrant,val,acceptCount):
List_Of_Turtles = list()
p = list()
screen = turtle.getscreen()
screen.setup( width = 2000, height = 2000, startx = None, starty = None)
for i in range(count):
screen.tracer(10)
List_Of_Turtles.append(turtle.Turtle())
#print "here",i,acceptCount,count
List_Of_Turtles[i].color("red")
if i >= acceptCount-1 and acceptCount!= 0:
List_Of_Turtles[i].shape("square")
List_Of_Turtles[i].color("green")
List_Of_Turtles[i].speed(1)
List_Of_Turtles[i].width(4)
angle = math.atan((y[i]-x[i])/300.0)
p.append(math.sqrt(90000+(x[i]-y[i])*(x[i]-y[i])))
if val == 200:
Position_Set(List_Of_Turtles[i],val-275,200-x[i])
else:
Position_Set(List_Of_Turtles[i],val,200-x[i])
if isGrant == 1:
List_Of_Turtles[i].right(180-math.degrees(angle)+90)
else:
List_Of_Turtles[i].right(math.degrees(angle)+90)
screen.update()
for i in xrange(100):
j=0
for t in List_Of_Turtles:
t.down()
if (i*(i+1))/2 < p[j]:
t.forward(i)
j=j+1
screen.update()
开发者ID:harisphnx,项目名称:networking,代码行数:35,代码来源:roundrobin.py
示例13: viewer
def viewer(dna):
'''Display ORFs and GC content for dna.'''
dna = dna.upper() # make everything upper case, just in case
t = turtle.Turtle()
turtle.setup(1440, 240) # make a long, thin window
turtle.screensize(len(dna) * 6, 200) # make the canvas big enough to hold the sequence
# scale coordinate system so one character fits at each point
setworldcoordinates(turtle.getscreen(), 0, 0, len(dna), 6)
turtle.hideturtle()
t.speed(0)
t.tracer(100)
t.hideturtle()
# Draw the sequence across the bottom of the window.
t.up()
for i in range(len(dna)):
t.goto(i, 0)
t.write(dna[i],font=("Helvetica",8,"normal"))
# Draw bars for ORFs in forward reading frames 0, 1, 2.
# Draw the bar for reading frame i at y = i + 1.
t.width(5) # width of the pen for each bar
for i in range(3):
orf(dna, i, t)
t.width(1) # reset the pen width
gcFreq(dna, 20, t) # plot GC content over windows of size 20
turtle.exitonclick()
开发者ID:BazzalSeed,项目名称:Python_Practices,代码行数:31,代码来源:temp.py
示例14: saveImg
def saveImg():
print("Done.")
save = input("Would you like to save this tree? Y/N \n")
if save.upper() == "Y":
t.hideturtle()
name = input("What would you like to name it? \n")
nameSav = name + ".svg"
ts = turtle.getscreen().getcanvas()
canvasvg.saveall(nameSav, ts)
elif save.upper() == "N":
def runChk():
runAgain = input("Would you like to run again? Y/N (N will exit)")
if runAgain.upper() == "Y":
print("Running")
main()
elif runAgain.upper() == "N":
print("Exiting...")
exit()
else:
print("Invalid response.")
runChk()
runChk()
else:
print("Invalid response.")
saveImg()
开发者ID:ayebiz,项目名称:Python-Learning,代码行数:25,代码来源:LearnOutputToFile.py
示例15: draw
def draw(x,y,count,isGrant,val):
tlist = list()
p = list()
screen = turtle.getscreen()
screen.setup( width = 2000, height = 2000, startx = None, starty = None)
for i in range(count):
screen.tracer(10)
tlist.append(turtle.Turtle())
tlist[i].color("red")
tlist[i].speed(1)
tlist[i].width(4)
angle = math.atan((y[i]-x[i])/300.0)
p.append(math.sqrt(90000+(x[i]-y[i])*(x[i]-y[i])))
tlist[i].up()
if val == 200:
tlist[i].back(val-275)
else:
tlist[i].back(val)
tlist[i].left(90)
tlist[i].forward(200-x[i])
if isGrant == 1:
tlist[i].right(180-math.degrees(angle)+90)
else:
tlist[i].right(math.degrees(angle)+90)
screen.update()
for i in xrange(100):
j=0
for t in tlist:
t.down()
if (i*(i+1))/2 < p[j]:
t.forward(i)
j=j+1
screen.update()
开发者ID:harisphnx,项目名称:networking,代码行数:34,代码来源:newPim_work.py
示例16: d
def d(fill=False):
'''draws a capital D'''
turtle.setheading(0)
if fill: bf()
fd(20)
circle(20, 90)
fd(70)
circle(20, 90)
fd(20)
lt(90)
fd(110)
lt(90)
if fill: ef()
pu()
turtle.goto(turtle.xcor() + 10, turtle.ycor() + 10)
pd()
cfc = fc()
fc(turtle.getscreen().bgcolor())
bf()
fd(10)
circle(10, 90)
fd(70)
circle(10, 90)
fd(10)
lt(90)
fd(90)
ef()
lt(90)
pu()
turtle.goto(turtle.xcor() + 40, turtle.ycor() - 10)
pd()
fc(cfc)
开发者ID:BoroDojo,项目名称:borodojo-python,代码行数:32,代码来源:fredx.py
示例17: draw_sequence
def draw_sequence(n, speed):
window = turtle.Screen()
window.bgcolor('white')
window.screensize(n**1.2, n**1.2)
alpha = turtle.Turtle()
alpha.shape('classic')
alpha.color('black')
alpha.speed(speed)
draw_square(alpha, fib(n))
# draw_circle(alpha, fib(n))
#turtle.getscreen().getcanvas().postscript(file='screen.eps')
turtle.getscreen().getcanvas().postscript(file='screen.eps')
window.exitonclick()
开发者ID:rzzzwilson,项目名称:Random-Stuff,代码行数:17,代码来源:test.py
示例18: Paint_Text
def Paint_Text(text,back,up):
screen = turtle.getscreen()
Temp_Turtle = turtle.Turtle()
screen.tracer(0)
Position_Set(Temp_Turtle,back,up)
Temp_Turtle.write(text,font=("Arial", 20, "normal"))
Temp_Turtle.hideturtle()
screen.update()
开发者ID:harisphnx,项目名称:networking,代码行数:8,代码来源:roundrobin.py
示例19: drawText
def drawText(text,back,up):
screen = turtle.getscreen()
turt = turtle.Turtle()
screen.tracer(0)
setPos(turt,back,up)
turt.write(text,font=("Arial", 20, "normal"))
turt.hideturtle()
screen.update()
开发者ID:PavithraP,项目名称:CN,代码行数:8,代码来源:rr.py
示例20: drawImage
def drawImage(paths):
myTurtle = turtle.Turtle(shape="turtle")
turtle.screensize(2000,2000)
myTurtle.pendown()
myTurtle.penup()
myTurtle.setposition(0, 0)
y = 0
for path in paths:
myTurtle.penup()
temp = path[0]
myTurtle.setposition(temp[0], temp[1])
myTurtle.pendown()
y = 1
for x in paths:
for y in x:
myTurtle.setposition(y[0], y[1])
myTurtle.penup()
turtle.getscreen()._root.mainloop()
开发者ID:mmercedes,项目名称:18-549,代码行数:18,代码来源:pi2c.py
注:本文中的turtle.getscreen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论