http://qs1969.pair.com?node_id=11140539


in reply to Re: Tk performance and "UpdateWrapper: Failed to create container"
in thread Tk performance and "UpdateWrapper: Failed to create container"

Hi and thanks for your answer.
Do you know if there is way to set a breakpoint in the execution before ending up in the UpdateWrapper? It is not my intent to modify the main window while running so I need to debug it to understand what is happening.
I suppose it is down in som XS code somewhere, which is a bit outside my comfortability zone.

Replies are listed 'Best First'.
Re^3: Tk performance and "UpdateWrapper: Failed to create container"
by Marshall (Canon) on Jan 18, 2022 at 07:20 UTC
    I think trying to debug Tk is very unlikely to result in success for your application.

    If you exceed some Tk limit and that causes some error, then try another way.
    Finding and fixing some Tk bug is a very last resort.

    Please explain why my code at Marshall's TableMatrix code is not a sufficient example which can be adapted to your needs?

    That explanation would help all of us Monks understand what you are trying to do. At this point, I don't think any of us are sure.

    GUI code can be very, very tricky to write. And a lot of experimentation is usually required.

      Marshall, indeed, your TableMatrix seems to do the trick, at least performance-wize. It is significantly faster than my old "widget by widget" solution. As most of my cells are simple text fields with just the occasional Combobox and Checkbox, a lot less widgets now need to be created.

      However, autosizing of columns I do miss from before when using the grid() packer to keep track of my "spreadsheet". Maybe someone knows of a solution?
      In my grid() packer solution, I simply set the width of my widgets to 0 and the geometry manager itself (or maybe the widgets themselves?) auto calculated the necessary width. Is there some means of doing this also for TableMatrix? I guess adding a method for it myself would be doable otherwize.

      Again, thanks for all your help. Bummer I didn't find TableMatrix myself.
        I suppose that you saw set_col_width($table,@col_heads); #THIS WILL CAUSE A SCREEN REFRESH! set_col_width() shows setting the width of individual columns specified in characters. In the demo, they all wind up being the same width, but of course they don't have to be. Due to perhaps proportional fonts, num of chars may not be the best measurement, but I think it is likely that you can come up with a heuristic that will work well.

        I found out that set_col_width() caused a screen refresh. I called that after say a column sort operation to update the screen. Anyway, this is a fast operation.

        In my application, I had an array structure ["headingname", width], etc. And I was fine with a "one size fits all" judgment of the width needed for each type of column. Mileage varies, I have no idea of what your data looks like.

        TableMatrix is a complicated GUI object. There are many, many options. I didn't use any color options, but that is a possibility. I did implement different behavior for left mouse click vs right mouse click within a cell and that worked out very well.

        Designing a good GUI can take a lot of effort. There were no existent GUI's for the class of application I was developing. I spent a couple of months carefully thinking through the information I wanted to display to the user. Doing something cool for the first time is hard.