wxFormBuilder

D

DoxaLogos

I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed, Boa
constructor), this is the first one I can actually use.

To use it wxFormBuilder with wxPython, I generated an xrc resource and
loaded it with wxPython. All the tedious GUI coding is gone :)

http://wxformbuilder.org/http://wiki.wxpython.org/index.cgi/XRCTutorial

I've stumbled across it myself and have found it superior so far over
the others. I just wish it could also crank out wxPython code. I'm
still hoping one day for a form designer closer to Visual Studio's
form designer in ease of use area. FarPy GUIE has the right idea, but
not near enough widget support. And, I'm not good enough at wxPython
yet to be able help either project.
 
S

Stef Mientki

sturlamolden said:
I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed, Boa
constructor), this is the first one I can actually use.

To use it wxFormBuilder with wxPython, I generated an xrc resource and
loaded it with wxPython. All the tedious GUI coding is gone :)

http://wxformbuilder.org/
http://wiki.wxpython.org/index.cgi/XRCTutorial

I've tried several of the above mentioned builders,
with the same result.
I've also looked at wxFormBuilder,
but I found it far too difficult and
fully unreadable (how can you create actions/bindings on components you don't see ?).
So I might be very very naive,
but why all so complex ??

I wrote a few lines of code,
and now all my form designs look as simple as this:

GUI = """
self.Splitter_Plots ,SplitterVer
self.Panel ,PanelVer, 010
self.Panel_Top ,PanelHor, 11
Label_Top ,wx.StaticText
self.Scope_Canvas ,PlotCanvas ,self, Real_Time
self.Panel_Bottom ,PanelHor
Label_Bottom ,wx.StaticText
self.Scope_History ,PlotCanvas_History ,self, Real_Time
"""
exec ( Create_GUI ( GUI, 'Plots_Dock' ) )

cheers,
Stef
 
S

sturlamolden

I've tried several of the above mentioned builders,
with the same result.
I've also looked at wxFormBuilder,
but I found it far too difficult and
fully unreadable (how can you create actions/bindings on components you don't see ?).
So I might be very very naive,
but why all so complex ??


Complex? Not at all! Let me show you an 'hello world!' example. Below
is the content of two files: HelloWorld.py hand-written be me, and
HelloWorld.xrc emitted by wxFormBuilder. I gave each control a care
about a name in wxFormBuilder, and use that to e.g. bind events and
load resources.





HelloWorld.py:

import wx
from wx import xrc
import sys

class MainFrame(object):

def __init__(self, xml):
self.xml = xml
self.frame = xml.LoadFrame(None,'MainFrame')
self.frame.Bind(wx.EVT_MENU, self.on_menu_exit,
id=xrc.XRCID('menuExit'))
self.frame.Bind(wx.EVT_BUTTON, self.on_say_hello,
id=xrc.XRCID('btnSayHello'))
self.frame.Show()

def on_say_hello(self, evt):
dlg = self.xml.LoadDialog(self.frame, 'HelloDialog')
dlg.ShowModal()
dlg.Destroy()

def on_menu_exit(self, evt):
self.frame.Destroy()
sys.exit(0)


class HelloWordApp(wx.App):

def OnInit(self):
xml = xrc.XmlResource('HelloWorld.xrc')
self.MainFrame = MainFrame(xml)
return True


if __name__ == '__main__':
app = HelloWordApp(0)
app.MainLoop()






HelloWorld.xrc:


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<resource xmlns="http://www.wxwindows.org/wxxrc" version="2.3.0.1">
<object class="wxFrame" name="MainFrame">
<style>wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL</style>
<size>289,171</size>
<title></title>
<object class="wxMenuBar" name="m_menubar2">
<label></label>
<object class="wxMenu" name="fileMenu">
<label>File</label>
<object class="wxMenuItem" name="menuExit">
<label>Exit </label>
<help></help>
</object>
</object>
</object>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL</
flag>
<border>5</border>
<object class="wxButton" name="btnSayHello">
<label>Say hello</label>
<default>0</default>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
</object>
</object>
<object class="wxDialog" name="HelloDialog">
<style>wxDEFAULT_DIALOG_STYLE</style>
<size>190,144</size>
<title></title>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="m_staticText11">
<font>
<size>14</size>
<family>swiss</family>
<style>normal</style>
<weight>normal</weight>
<underlined>0</underlined>
<face>Times New Roman</face>
</font>
<label>Hello World!</label>
</object>
</object>
<object class="spacer">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<size>0,0</size>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND | wxALL</flag>
<border>5</border>
<object class="wxStaticLine" name="m_staticline4">
<style>wxLI_HORIZONTAL</style>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<border>5</border>
<object class="wxStdDialogButtonSizer">
<object class="button">
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
<border>5</border>
<object class="wxButton" name="wxID_OK">
<label>&amp;OK</label>
</object>
</object>
</object>
</object>
</object>
</object>
</resource>
 
S

sturlamolden

I've tried several of the above mentioned builders,
with the same result.
I've also looked at wxFormBuilder,
but I found it far too difficult and
fully unreadable (how can you create actions/bindings on components you don't see ?).
So I might be very very naive,
but why all so complex ??


It is not complex. I have posted a small 'Hello World!' howto on my
blog. It shows you how to bind events:

http://sturlamolden.blogspot.com/2008/03/howto-using-wxformbuilder-with-wxpython.html
 
C

CM

I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed,Boa
constructor), this is the first one I can actually use.

Why can't you use Boa Constructor? I really enjoy using it.
 
B

Bill

sturlamolden wrote, On 3/20/2008 9:41 AM:
I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed, Boa
constructor), this is the first one I can actually use.

To use it wxFormBuilder with wxPython, I generated an xrc resource and
loaded it with wxPython. All the tedious GUI coding is gone :)

http://wxformbuilder.org/
http://wiki.wxpython.org/index.cgi/XRCTutorial


What don't you like about wxGlade? It actually generates Python code.
There has been a lot more development going on recently, too.

Bill
 
B

Bill

sturlamolden wrote, On 3/20/2008 9:41 AM:
I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed, Boa
constructor), this is the first one I can actually use.

To use it wxFormBuilder with wxPython, I generated an xrc resource and
loaded it with wxPython. All the tedious GUI coding is gone :)

http://wxformbuilder.org/
http://wiki.wxpython.org/index.cgi/XRCTutorial


What don't you like about wxGlade? It actually generates Python code.
There has been a lot more development going on recently, too.

Bill
 
B

Bill

sturlamolden wrote, On 3/20/2008 9:41 AM:
I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed, Boa
constructor), this is the first one I can actually use.

To use it wxFormBuilder with wxPython, I generated an xrc resource and
loaded it with wxPython. All the tedious GUI coding is gone :)

http://wxformbuilder.org/
http://wiki.wxpython.org/index.cgi/XRCTutorial


What don't you like about wxGlade? It actually generates Python code.
There has been a lot more development going on recently, too.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top