Hi all,

I was searching for an IDE that is capable of Python GUI drawing, much like MSVS can draw GUI windows without actually having to code them manually.
Atm I use NetBeans 6.5 for Python, but I can switch.

Yeah, I'd prefer a Linux based IDE of course :)

Thanks

Since you're on Linux I recommend Glade for pyGtk. Go with Glade 3. Works like a charm, easy to use, saves time (bad Windows support though).

If you're a kde user, then a better choice might be QT designer, which comes with pyQT. I found it a good bit harder than Glade to use, but it's supposed to be good too.

Note: none of these software are IDEs; they are just designers that create UI files that you "load" into your python program, so don't throw away netbeans.

I was searching for an IDE that is capable of Python GUI drawing, much like MSVS can draw GUI windows without actually having to code them manually.

You might want to take a look at Boa-constructor, which works with wxPython. I haven't tried it yet, but it seems to be the best choice I've come across.

I find designers rather cumbersome, they throw in more code than you want to have, and you have a much harder time fleshing out to working program.

You are better off collecting a set of working templates of the various widgets you are interested in, and copy and paste from there to create your program.

If you use the wxPython GUI toolkit then Boa-Constructor isn't too bad, since it also is a regular IDE that you can write and run your programs with. It does create Python code rather than XML code.

On my Ubuntu machine I installed SPE (written in wxPython) and it has wxGlade as a designer tool, seems to work okay. This way you can test out your code quickly.

I remember trying to write a "Boa for Dummies" blow by blow instruction. Take a look at:
http://www.daniweb.com/forums/post400296-107.html

It should at least give you a taste what things you are up to with a designer for your GUI programs. Believe me, Boa is one of the friendlier ones.

A while ago I used QtDesigner for a similar task. It layed out the widgets alright, but then it saved it in XML code as a .ui file. PyQT comes with a utility that translates UI to PY code. The Python code it generated gets you into some rather nasty unreadable Python code, big time vomit code!

you guys sure? Boa looks like it's something I would have written in TP7 when I was a kid... but first looks may be deceiving :)

I've tried Glade3 as well, converted the .glade file to .xml, but couldn't manage to get the script to read it properly for some reason.
btw, can I use glade with the wx module?

It have been easier for me to "Hard code" than using designers. You have complete control over the code and can do any change and of course code re-use :)

you guys sure? Boa looks like it's something I would have written in TP7 when I was a kid... but first looks may be deceiving :)

I've tried Glade3 as well, converted the .glade file to .xml, but couldn't manage to get the script to read it properly for some reason.
btw, can I use glade with the wx module?

On my Ubuntu machine I installed SPE (written in wxPython) and it has wxGlade as a designer tool, seems to work okay. However, the output is an XML file again. You can use wxPython code to import these XML files as resource files.

I filed this code that Vegaseat left some a time ago:

# use an xml resource string or file to create widgets
# you can create .xrc or .xml files with something like wxGlade
# wxGlade from: http://wxglade.sourceforge.net/
# source: vegaseat

import  wx
import  wx.xrc  as  xrc

class MyFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(400, 300))

        self.toggle = True

        # load the xml resource file
        # should be in your working folder or use full path
        res = xrc.XmlResource('resource.xrc')

        '''
        # or you can use a resource string directly
        res = xrc.EmptyXmlResource()
        res.LoadFromString(xml_resource)
        '''

        # create the panel from the resource
        self.panel = res.LoadPanel(self, 'MyPanel')
        # bind mouse click to the button in the resource
        self.Bind(wx.EVT_BUTTON, self.onClick,
            id=xrc.XRCID('ColourButton'))
        self.Bind(wx.EVT_BUTTON, self.showInfo,
            id=xrc.XRCID('InfoButton'))

    def onClick(self, event):
        """do something with the button click"""
        if self.toggle:
            self.panel.SetBackgroundColour('green')
            self.toggle = False
        else:
            self.panel.SetBackgroundColour('red')
            self.toggle = True
        self.panel.Refresh()

    def showInfo(self, event=None):
        """optional show xml code"""
        dlg = wx.MessageDialog(self, xml_resource,
            'This is the xml code used:',
            wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()


# this is an xml resource file
# here a simple panel with two buttons
xml_resource = """\
<?xml version="1.0" ?>
<resource>
   <object class="wxPanel" name="MyPanel">
      <bg>#E6E6FA</bg>
      <object class="wxButton" name="ColourButton">
         <bg>#F0E68C</bg>
         <label>Click me!</label>
         <pos>15,10</pos>
      </object>
      <object class="wxButton" name="InfoButton">
         <bg>#F0E68C</bg>
         <label>Information</label>
         <pos>15,40</pos>
      </object>
   </object>
</resource>
"""

# for the test save the xml code as resource.xrc
fout = open('resource.xrc', "w")
fout.write(xml_resource)
fout.close()

app = wx.App(0)
title = 'xml resource to create widgets'
MyFrame(None, title).Show()
app.MainLoop()

Thanks a million guys, I'll keep popping in and bothering you with more questions, as they arise :)

This question has already been answered. Start a new discussion instead.