Пример #1
0
 def resize(self, width, height):
   PApplet.resize(self,width,height)
   # TODO figure out how to handle resize in context of Swing signals etc
   self.w = width
   self.h = height
   if self.view is not None:
     self.view.resize(self.w, self.h, False)
Пример #2
0
def Q(name):
    """Gets a variable from the current sketch. Processing has a number
    of methods and variables with the same name, 'mousePressed' for
    example. This allows us to disambiguate.

    Also casts numeric values as floats to make it easier to translate
    code from pde to python.

    """
    retval = PApplet.getDeclaredField(name).get(Sketch.get_instance())
    if isinstance(retval, (long, int)):
        return float(retval)
    else:
        return retval
Пример #3
0
def __saveBytes__(where, data):
    if isinstance(where, basestring):
        return __papplet__.saveBytes(where, data)
    return PApplet.saveBytes(where, data)
Пример #4
0
def __saveStream__(target, source):
    if isinstance(source, basestring) or isinstance(target, basestring):
        return __papplet__.saveStream(target, source)
    return PApplet.saveStream(target, source)
Пример #5
0
def __loadJSONObject__(o):
    if isinstance(o, basestring):
        return __papplet__.loadJSONObject(o)
    return PApplet.loadJSONObject(o)
Пример #6
0
def __loadJSONArray__(o):
    if isinstance(o, basestring):
        return __papplet__.loadJSONArray(o)
    return PApplet.loadJSONArray(o)
Пример #7
0
def __loadBytes__(o):
    if isinstance(o, basestring):
        return __papplet__.loadBytes(o)
    return PApplet.loadBytes(o)
Пример #8
0
def __createWriter__(o):
    if isinstance(o, basestring):
        return __papplet__.createWriter(o)
    return PApplet.createWriter(o)
Пример #9
0
 def mouseDragged(self,evt):
   if type(evt) is javaMouseEvent:
     PApplet.mouseDragged(self, evt)
   elif type(evt) is p5MouseEvent:
     self.view.mouseDragged()
     self.draw()
Пример #10
0
def __loadJSONArray__(o):
    if isinstance(o, basestring):
        return __papplet__.loadJSONArray(o)
    return PApplet.loadJSONArray(o)
Пример #11
0
def __loadBytes__(o):
    if isinstance(o, basestring):
        return __papplet__.loadBytes(o)
    return PApplet.loadBytes(o)
Пример #12
0
def __createWriter__(o):
    if isinstance(o, basestring):
        return __papplet__.createWriter(o)
    return PApplet.createWriter(o)
Пример #13
0
def __createOutput__(o):
    if isinstance(o, basestring):
        return __papplet__.createOutput(o)
    return PApplet.createOutput(o)
Пример #14
0
def __saveBytes__(where, data):
    if isinstance(where, basestring):
        return __papplet__.saveBytes(where, data)
    return PApplet.saveBytes(where, data)
Пример #15
0
def __saveStream__(target, source):
    if isinstance(source, basestring) or isinstance(target, basestring):
        return __papplet__.saveStream(target, source)
    return PApplet.saveStream(target, source)
Пример #16
0
def __loadJSONObject__(o):
    if isinstance(o, basestring):
        return __papplet__.loadJSONObject(o)
    return PApplet.loadJSONObject(o)