Passing JS new
operator to Brython !?
#2213
-
Hi everyone, I would like to call a JS library trough Brython. in my previous JS code I had var IcoExt = L.Icon.extend({
options: {
shadowUrl: 'shadow.png',
iconSize: [32, 32],
shadowSize: [0, 0],
iconAnchor: [16, 31],
shadowAnchor: [4, 62],
popupAnchor: [0, -30]
}
});
var pink = new IcoExt({iconUrl: 'Pink.png'}); So I don't really understand the last line The first part is easy to translate to Brython/Python IcoExt = window.L.Icon.extend({
'options': {
'shadowUrl': 'static/map/trans.png',
'iconSize': [32, 32],
'shadowSize': [0, 0],
'iconAnchor': [16, 31],
'shadowAnchor': [4, 62],
'popupAnchor': [0, -30]}
}) But the second (related to pink = IcoExt({'iconUrl': 'Pink.png'}) give me:
Any ideas ? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
A search on "Javascript new" returns this page. Brython documentation about using Javascript objects explains that Javascript constructors used in Brython code have a method |
Beta Was this translation helpful? Give feedback.
A search on "Javascript new" returns this page.
Brython documentation about using Javascript objects explains that Javascript constructors used in Brython code have a method
jsobj.new(args)
which is the equivalent of Javascriptnew jsobj(args)
.