I'm trying to use a custom icon in the titlebar (and taskbar if possible) of a GUI made in Traits UI, however I cannot find any information on how to do so. There is an icon
attribute in the Traits UI View class, but I can't get it to change anything:
http://docs.enthought.com/traitsui/traitsui_user_manual/custom_view.html#index-15
Google suggests there may be a convoluted solution involving directly interacting with pyqt4 but I wanted to check there wasn't a simpler solution first.
The gui is intended to run on Linux and Windows.
The solution was to use the pyface ImageResource
class. See:
from traits.api import HasTraits, Str
from traitsui.api import View, Item
from pyface.image_resource import ImageResource
class Person(HasTraits):
first_name = Str
last_name = Str
view = View(Item('first_name'),
Item('last_name'),
icon=ImageResource('image_path.png'))
Person().configure_traits()