Search code examples
c#pythondatagrid

C# GUI for python hangs


I am calling a c#-dll from python. The DLL is my GUI.

The GUI contains a dataGrid with 2 columns for 2 strings.

If I call the GUI by Python with clr.AddReference("myGUI.dll") I can comfortably run the GUI and debug my python script and manually access the c# stuff and add rows to the grid in the script or manually.

But if the rows in the grid are full, and a scroll-bar appears, this is the moment, the GUI hangs. It's sometimes possible to add some rows and change something at the GUI items, but if I click on any object, nothing happens, and windows reports after some time: "app is not responding".

Does anybody know this issue? What can I do?


Solution

  • After trying a lot of stuff, the following works for me:

    In Form1_Load I fill the dataGrid with a lot of rows, so that the scrollbar appears. Then I can reduce or fill them via Python - no problem any more, scrollbar disapears for less rows and appears again, if needed. No blocking GUI anymore.

    To let the scrollbar appeare once seems to call initially anything in the form. Which works automatically since it is called once.