Skip to main content

All Questions

Tagged with
0 votes
0 answers
14 views

How to catch leaflet event and send it to a Traits app?

I have a Python Traits app which consists in a instance of the HTML class (to say short). In this instance, I have a leaflet map. That works fine (it displays a leaflet map). I know how to catch ...
Fred's user avatar
  • 1
0 votes
1 answer
51 views

Handle nested traits changes with traits api

I am having some issues building a GUI with traits and traitsui. What I am trying to do can be simplified to the following: from traits.api import List, Str, on_trait_change, Trait, HasTraits from ...
narsonalin's user avatar
0 votes
2 answers
301 views

Python mixins : how to deal with *args, **kwargs when calling super()?

In the following example I show some mixins that may or may not use *args or **kwargs: class AMixin(): def __init__(self, **kwargs): print("AMixin") self.a = 'a' + str(...
nowox's user avatar
  • 28.9k
1 vote
2 answers
610 views

How to specify variable-length tuple of specific type in traits?

from traits.api import HasTraits, Str, Tuple class Data(HasTraits): values = Tuple(Str, ...) data = Data(values=("a", "b", "c")) Output: TraitError: The '...
Hisham Syed's user avatar
0 votes
1 answer
65 views

Adding methods (roles) to a class on the fly in Python - dangers?

I'm learning python, and having fun with classes. Since I'm used to roles or traits in other contexts and found them extremely useful, I was looking into the same kind of thing - adding a class to ...
simone's user avatar
  • 5,167
2 votes
2 answers
694 views

Set ipywidget options with nothing selected

When I want to set options in an ipywidget with nothing selected I would simply do this: import ipywidgets as w w.Select(options=[1, 2], value=None) What if I wanted to set new items (with nothing ...
alex's user avatar
  • 11.4k
2 votes
0 answers
469 views

Change pointer cursor in jupyter over ipywidgets

I've been searching and I can't find a way to change the cursor in a jupyter notebook. I'm working with my own designed file chooser using ipywidgets and I want to change the cursor image every time ...
dguerrero's user avatar
  • 369
2 votes
1 answer
902 views

PyO3 - passing class extending another class as a function argument

I have a library in Rust and I want to be able to use it from Python. So I can do the bindings using PyO3. Let's suppose that I have a following library in Rust: pub trait Animal { fn make_sound();...
Damian's user avatar
  • 308
-1 votes
1 answer
653 views

how could i use @ character as a Rust decorator to implement trait to a struct?

How could i use decorator with if possible @ character to have python style taste while implementing traits on my structs ? trait Animal { fn get_name(&self) -> &str { &...
laticoda's user avatar
  • 118
0 votes
3 answers
185 views

How do I update the dictionary of a mapped trait, after I've already constructed it?

I need to update the dictionary of a mapped trait some time after initial trait creation. How do I do this? The following code: from traits.api import (HasTraits, Trait) class bar(HasTraits): ...
dbanas's user avatar
  • 1,868
1 vote
0 answers
377 views

Traitlets: Best way for a "Dict of Instance"?

In my code, I need a Dict of Instance (for example a list of Parameter keyed by name). Currently I've solved this by using a regular Dict-traitlet as the incoming property (parameters) and then having ...
Blizz's user avatar
  • 8,390
4 votes
0 answers
1k views

Converting GUI-application into .exe-file with cx_Freeze: no plugin found for toolkit qt4

My program contains mayavi, traits and pyqt5 elements in order to visualize something in 3D. I tried to convert my GUI-Application with cx_Freeze and it created the exe-file ,but running it I got the ...
roflcopter122's user avatar
1 vote
1 answer
71 views

Initialisation of traits.Tuple value in a traits.Tuple object

>>> import traits.api as traits >>> class Foo(traits.HasTraits): ... eTest = traits.Tuple((0.0001, 60, traits.Tuple(traits.Bool(False), traits.Bool(True)))) ... >>> a=Foo()...
servoz's user avatar
  • 657
0 votes
0 answers
71 views

"Do not create a new QApplication" when embedding mayavi in QT?

In the official example of "embedding mayavi in QT" http://docs.enthought.com/mayavi/mayavi/auto/example_qt_embedding.html#example-qt-embedding, the main code says: if __name__ == "__main__": # ...
Alex's user avatar
  • 1,014
3 votes
1 answer
189 views

How to enable right-click menu in TraitsUI TreeView when using adaptors?

I have modified the Adapted_tree_editor_demo.py example code to display some simple model objects using the adaptor approach. However, right-click menu options are all disabled. How can I enable them? ...
Daniel Farrell's user avatar

15 30 50 per page
1
2 3 4 5
8