(The latest v2 can be seen in the post #3)
(Here is the first v1)
I made a simple test code in blender python and I wanted to add a GUI to it so that other people can also try it, but I faced kind of a difficulty to write the code for the GUI.I thought that it would be nice if there is a way to add a GUI taking less time and work, and I created a class and a sample code that explains how to use the class, in order to use it as a template for the next time and after.
First, here is the .blend file that includes all the codes needed:
What is the code like?
What you have to do to make your GUI is only to paste the class code on your source code and change the codes marked with the green rectangles as the image above to whatever you like.
It is necessary to write the code in the event handler OnDrawFirst, where you specify the initial values, and the code in OnRedraw, where you specify how the GUI components are. You can add more events, if needed.
This page helped me with creating the codes in OnRedraw.
There will be another well-considered template code in the world, I guess. Please give me your idea :):)
I’m wondering whether it woud be interesting to create another classes that allow you to write codes similar to those for UI in Java or .Net.:spin: