I want to be able to capture key-press events in a Julia powered PyQtGraph GUI using the amazing PyCall package, but have been unable to because I can’t make python classes with static attributes using the
@pydef macro in PyCall.
Moreover, when I try to make any class with a static attribute using
@pydef, I get the following error:
julia> @pydef mutable struct Foo class_attr = 1 function __init__(self) println(self[:class_attr]) end end ERROR: AssertionError: Not a function definition: class_attr = 1
which is equivalent (I hope) to the following python code:
class Foo(object): class_attr= 1 def __init__(self): print(self.class_attr)
Looking at the source code responsible for parsing the contents of a
@pydef macro call makes me think that this capability is simply not yet implemented.
I have already opened an issue in PyCall, but was wondering if there is some other way to make a python class with a static attribute that I’m missing?