Le retour de bobino
This commit is contained in:
parent
d0b072b9c1
commit
6f45a93913
@ -1,6 +1,6 @@
|
||||
from ivy.std_api import IvyBindMsg, IvySendMsg, IvyMainLoop
|
||||
|
||||
import myIvy
|
||||
from LibCommon import myIvy
|
||||
from threading import Timer
|
||||
|
||||
|
||||
@ -75,6 +75,6 @@ class MyIvyMultiModale(myIvy.MyIvy):
|
||||
IvyBindMsg(self.a.new_vocal_action, '^VOCAL action=(.*)')
|
||||
|
||||
|
||||
MyIvyMultiModale("MultiModal", "172.31.190.255:2010")
|
||||
MyIvyMultiModale("MultiModal", "127.255.255.255:2010")
|
||||
|
||||
IvyMainLoop()
|
@ -1,5 +1,5 @@
|
||||
import turtle
|
||||
import myIvy
|
||||
from LibCommon import myIvy
|
||||
from ivy.std_api import *
|
||||
|
||||
LIST_FORM = []
|
||||
@ -36,15 +36,17 @@ class Rectangle(Form):
|
||||
|
||||
|
||||
class MyTurtle(turtle.Turtle):
|
||||
def __init__(self, color="green"):
|
||||
def __init__(self, color="green", bgcolor="#FFFFFF"):
|
||||
turtle.Turtle.__init__(self, shape="turtle")
|
||||
self.bgcolor = bgcolor
|
||||
|
||||
self.pensize(3)
|
||||
self.my_turtle_color = color
|
||||
self.color(color)
|
||||
|
||||
self.screen = turtle.Screen()
|
||||
|
||||
self.screen.bgcolor("#FFFFFF")
|
||||
self.screen.bgcolor(bgcolor)
|
||||
self.screen.title("Palette")
|
||||
self.screen.setup(1000, 600, 1, -1)
|
||||
self.screen.setworldcoordinates(0, 600, 1000, 0)
|
||||
@ -84,9 +86,9 @@ class MyTurtle(turtle.Turtle):
|
||||
self.__end_draw()
|
||||
|
||||
def delete_rectangle(self, rectangle):
|
||||
self.__setup_draw(rectangle.x, rectangle.y, color="#FFFFFF")
|
||||
self.__setup_draw(rectangle.x, rectangle.y, color=self.bgcolor)
|
||||
|
||||
def onclick(self, x, y):
|
||||
def onclick(self, x, y, **kwargs):
|
||||
myturtle.goto(x, y)
|
||||
IvySendMsg("PALETTE x={} y={}".format(x, y))
|
||||
|
||||
@ -96,10 +98,13 @@ class MyIvyPalette(myIvy.MyIvy):
|
||||
IvyBindMsg(self.create, '^MULTIMODAL forme=(.*) x=(.*) y=(.*) couleur=(.*)')
|
||||
|
||||
def create(self, agent, *larg):
|
||||
print('create [%s]', larg)
|
||||
if larg[0] == "RECTANGLE":
|
||||
LIST_FORM.append(Rectangle(larg[1], larg[2], 200, 100, larg[3]))
|
||||
r = Rectangle(larg[1], larg[2], 200, 100, larg[3])
|
||||
myturtle.draw_rectangle(r)
|
||||
LIST_FORM.append(r)
|
||||
elif larg[0] == "ROND":
|
||||
c = Circle(larg[1], larg[2], 50, larg[3])
|
||||
myturtle.draw_circle(c)
|
||||
LIST_FORM.append(Circle(larg[1], larg[2], larg[3]))
|
||||
|
||||
|
||||
@ -116,6 +121,6 @@ myturtle.draw_rectangle(Rectangle(300, 300, 100, 200, color="blue"))
|
||||
myturtle.setposition(500, 450)
|
||||
myturtle.draw_circle_here()
|
||||
|
||||
my_ivy = MyIvyPalette("Palette", "172.31.190.255:2010")
|
||||
my_ivy = MyIvyPalette("Palette", "127.255.255.255:2010")
|
||||
|
||||
myturtle.screen._root.mainloop()
|
||||
|
Reference in New Issue
Block a user