Note the call to update; calls to the draw methods
made before the widget has been displayed are lost. You don’t need
to call this method if you’re calling the drawing methods from within
your Tkinter program (for example, in response to a button press or
a menu choice).

The widget currently ignores drawing operations that are made before
the widget has been displayed. Maybe the widget should collect such calls
in a list, and use that list to update the pixmap when it is first
created. In the drawing methods, you could do something like:

Another problem is that the widget resizes the pixmap on each call
to ui_handle_resize. If the user makes the widget very small,
and changes the size back again, the contents will be lost. Maybe
the widget should limit the minimum size to the current width
and height settings?