up with PyGUI!

Ed Leafe ed at leafe.com
Sun Sep 26 08:28:10 EDT 2004


On Sep 26, 2004, at 2:31 AM, OKB (not okblacke) wrote:

>     		How am I supposed to know, just by looking at that, which
> controls are in which sizers and what the relationship is between the
> two sizers?  I have to visually parse every single line -- not just the
> creation of each widget, but also the line that adds it to a sizer.  
> And
> there could easily be an inconsistency -- you might accidentally give a
> widget a parent that's inconsistent with the sizer you add it to.  With
> a nested structure it becomes clear:
>
> class frame(wxFrame):
>     	class sizer1(wxBoxSizer):
>     	    	class button1(wxButton):
>     	    	    	# name, size, etc.
>     	    	class button2(wxButton):
>     	    	    	# etc.
>     	    	class panel(wxPanel):
>     	    	    	class sizer2(wxBoxSizer):
>     	    	    	    	class listBox1(wxComboBox): # etc.
>     	    	    	    	class listBox2(wxComboBox): # etc.
>     	    	    	    	class button3(wxButton): # etc.
>     	    	    	    	class text(wxTextCtrl): # etc.

	Forgive me if this is an oversimplification, but it looks like what 
you want is an XML-based definition of your UI objects, and are trying 
to approximate that with Python syntax. What you've written looks an 
awful lot like an XRC file structure, albeit without the closing tags.

	In Dabo, our first attempt at creating a visual form designer was 
along the lines of PythonCard: place controls on their container, and 
resize/move them visually. Once we started to tackle nested containers, 
though, we abandoned that approach for the reasons you cited: it's 
simply too confusing to see what goes where. We are now working on 
adapting wxGlade to use Dabo classes, as that visually shows the 
nesting in a clear an unambiguous tree. Dabo would then know how to 
create the form from the XML, or, in the alternative, we would create 
Dabo code that the developer could then modify. The latter seems like 
it would have to be a one-way process, while keeping things in XML 
could allow for two-way editing.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/




More information about the Python-list mailing list