Understanding peer and TabPageContainer

I’m trying to use TabPage and TabContainer but I’m having problems understanding what is a peer and how I need to relate it with TabPage.

I’m able to add a TabPageContainer with Pages and add controls within a TabPage with the following piece of code, dc is a DialogControl and dm is the DialogControlModel

        self.dc.createPeer(self.toolkit, None)  
        book: UnoControlTabPageContainerModel = dm.createInstance(
            "com.sun.star.awt.tab.UnoControlTabPageContainerModel"
        )
        book.Name = "TabControl"
        book.PositionX = "18"
        book.PositionY = "15"
        book.Width = 130
        book.Height = 60
        dm.insertByName("TabControl", book)
        page_ad: UnoControlTabPageModel = book.createTabPage(1)
        page_ad.Title = "🔧 Parameters"
        book.insertByIndex(0, page_ad)
        page_ui: UnoControlTabPageModel = book.createTabPage(2)
        page_ui.Title = "👀 UI"
        book.insertByIndex(1, page_ui)

Note that the first line is

       self.dc.createPeer(self.toolkit, None)

If I don’t do this, I get the error

Traceback (most recent call last):
  File "/home/igor/playground/libreoffice/python-libreoffice-track/src/095_ui_tab_sample.py", line 166, in <module>
    run_hello_tab_sample()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/igor/playground/libreoffice/python-libreoffice-track/src/095_ui_tab_sample.py", line 134, in run_hello_tab_sample
    app.showDialog()
    ~~~~~~~~~~~~~~^^
  File "/home/igor/playground/libreoffice/python-libreoffice-track/src/095_ui_tab_sample.py", line 121, in showDialog
    self.dc.setVisible(True)
    ~~~~~~~~~~~~~~~~~~^^^^^^
uno.com.sun.star.uno.RuntimeException: No peer for tabpage container!

But when I do this, I loose NumericField Spinner controls. Is it needed to force a repaint ?

I initally have a sample that shows the increment/decrement for a Numeric Field like
screenshot-2025-09-11-075254

But when I add the code for tabs, the NumericFields look now like

screenshot-2025-09-11-075217

The full source code for the initial code is here

And with tabpagecontainer and tabpage is here

What I’m doing bad and how can it be fixed?

I’m running libreoffice 25.2 on Debian Forky with Python13. Thanks for hints and help.