Marius Trestioreanu | 1 Aug 10:09 2003
Picon

Re: Working with text files

Use ConfigParser module built in python:

The ConfigParser Module

The ConfigParser module reads configuration files.

The files should be written in a format similar to Windows INI files. The file contains one or more sections, separated by section names written in brackets. Each section can contain one or more configuration items.

Here's the sample file used in Example 5-16:

[book] title: The Python Standard Library author: Fredrik Lundh email: fredrik <at> pythonware.com version: 2.0-001115 [ematter] pages: 250 [hardcopy] pages: 350

Example 5-16 uses the ConfigParser module to read the sample configuration file.

Example 5.16. Using the ConfigParser Module

File: configparser-example-1.py import ConfigParser import string config = ConfigParser.ConfigParser() config.read("samples/sample.ini") # print summary print print string.upper(config.get("book", "title")) print "by", config.get("book", "author"), print "(" + config.get("book", "email") + ")" print print config.get("ematter", "pages"), "pages" print # dump entire config file for section in config.sections(): print section for option in config.options(section): print " ", option, "=", config.get(section, option) THE PYTHON STANDARD LIBRARY by Fredrik Lundh (fredrik <at> pythonware.com) 250 pages book title = The Python Standard Library email = fredrik <at> pythonware.com author = Fredrik Lundh version = 2.0-001115 __name__ = book ematter __name__ = ematter pages = 250 hardcopy __name__ = hardcopy pages = 350

In Python 2.0, the ConfigParser module also allows you to write configuration data to a file, as Example 5-17 shows.

Example 5.17. Using the ConfigParser Module to Write Configuration Data

File: configparser-example-2.py import ConfigParser import sys config = ConfigParser.ConfigParser() # set a number of parameters config.add_section("book") config.set("book", "title", "the python standard library") config.set("book", "author", "fredrik lundh") config.add_section("ematter") config.set("ematter", "pages", 250) # write to screen config.write(sys.stdout) [book] title = the python standard library author = fredrik lundh [ematter] pages = 250


...Marius



dini wahyuni | 1 Aug 15:15 2003
Picon

(no subject)

hi all....
i'm a newbie in Python especially boa-constructor. i want to ask u about build an aplication for database. i
need 
use postgresql. so how can i connect with postgresql using boa ( i read boa-constructor's help that bc is 
isnpired by delphi). so is it has same function like delphi to build a database application? if not how i can
use the 
table from my database n display it in a grid (or something like that?).please if u cn tell me step by step, coz 
actually i dont so familar with bc.
thanx for all of u before.
ps :sorry if my english is not well.

Film & TV Extras urgently required in your area - See Yourself in major Films & TV? Call 0907 1512440 to
Register. calls cost 150pm  

Riaan Booysen | 5 Aug 11:11 2003
Picon

New features

Hi everyone,

I'm proud to tell you that Boa is the
Source Forge Project of the Month for August :)

There is also an interview (and a little picture
of me for the curious).
Follow the link from the Source Forge front page.

Hopefully the interview will also appear in the
August edition of Linux Magazine.

The second bit of good Boa news is that Boa now has
some support for using sizers in the Designer.

I've attached a sample of generated sizer code as a
preview.

I hope to check in version 0.2.5 to CVS within a week.

Cheers,
Riaan.
#Boa:Frame:wxFrame1

from wxPython.wx import *

def create(parent):
    return wxFrame1(parent)

[wxID_WXFRAME1, wxID_WXFRAME1BUTTON1, wxID_WXFRAME1BUTTON10, 
 wxID_WXFRAME1BUTTON11, wxID_WXFRAME1BUTTON12, wxID_WXFRAME1BUTTON13, 
 wxID_WXFRAME1BUTTON14, wxID_WXFRAME1BUTTON15, wxID_WXFRAME1BUTTON16, 
 wxID_WXFRAME1BUTTON17, wxID_WXFRAME1BUTTON18, wxID_WXFRAME1BUTTON19, 
 wxID_WXFRAME1BUTTON2, wxID_WXFRAME1BUTTON20, wxID_WXFRAME1BUTTON21, 
 wxID_WXFRAME1BUTTON3, wxID_WXFRAME1BUTTON4, wxID_WXFRAME1BUTTON5, 
 wxID_WXFRAME1BUTTON6, wxID_WXFRAME1BUTTON7, wxID_WXFRAME1BUTTON8, 
 wxID_WXFRAME1BUTTON9, wxID_WXFRAME1NOTEBOOK1, wxID_WXFRAME1PANEL1, 
 wxID_WXFRAME1PANEL2, wxID_WXFRAME1PANEL3, wxID_WXFRAME1PANEL4, 
 wxID_WXFRAME1STATICBOX1, 
] = map(lambda _init_ctrls: wxNewId(), range(28))

class wxFrame1(wxFrame):
    def _init_coll_boxSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.button1, 0, border=0, flag=wxALIGN_LEFT)
        parent.AddSizer(self.boxSizer2, 0, border=0, flag=wxALIGN_CENTER)
        parent.AddWindow(self.button3, 0, border=0, flag=wxALIGN_RIGHT)
        parent.AddWindow(self.button2, 1, border=0, flag=wxALIGN_CENTER)

    def _init_coll_flexGridSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.button10, 0, border=10, flag=wxALL)
        parent.AddWindow(self.button11, 0, border=10, flag=wxALL)
        parent.AddWindow(self.button12, 0, border=10, flag=wxALL)
        parent.AddWindow(self.button13, 0, border=10, flag=wxALL)
        parent.AddWindow(self.button14, 0, border=10, flag=wxALL)
        parent.AddWindow(self.button15, 0, border=10, flag=wxALL)

    def _init_coll_gridSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.button4, 0, border=0, flag=0)
        parent.AddWindow(self.button5, 0, border=0, flag=0)
        parent.AddWindow(self.button6, 0, border=0, flag=0)
        parent.AddWindow(self.button7, 0, border=0, flag=0)
        parent.AddWindow(self.button8, 0, border=0, flag=0)
        parent.AddWindow(self.button9, 0, border=0, flag=0)

    def _init_coll_boxSizer2_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.button19, 0, border=0, flag=0)
        parent.AddSpacer(8, 8, border=0, flag=0)
        parent.AddWindow(self.button20, 0, border=0, flag=0)
        parent.AddSpacer(8, 8, border=0, flag=0)
        parent.AddWindow(self.button21, 0, border=0, flag=0)

    def _init_coll_staticBoxSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddSpacer(8, 8, border=0, flag=wxALIGN_CENTER)
        parent.AddWindow(self.button16, 0, border=0, flag=wxALIGN_CENTER)
        parent.AddWindow(self.button17, 1, border=0, flag=wxALIGN_CENTER)
        parent.AddWindow(self.button18, 0, border=0, flag=wxALIGN_CENTER)
        parent.AddSpacer(8, 8, border=0, flag=wxALIGN_CENTER)

    def _init_coll_notebook1_Pages(self, parent):
        # generated method, don't edit

        parent.AddPage(imageId=-1, page=self.panel1, select=True,
              text='Box Sizer')
        parent.AddPage(imageId=-1, page=self.panel2, select=False,
              text='Grid Sizer')
        parent.AddPage(imageId=-1, page=self.panel3, select=False,
              text='Flex Grid Sizer')
        parent.AddPage(imageId=-1, page=self.panel4, select=False,
              text='StaticBox Sizer')

    def _init_sizers(self):
        # generated method, don't edit
        self.notebookSizer1 = wxNotebookSizer(nb=self.notebook1)

        self.boxSizer1 = wxBoxSizer(orient=wxVERTICAL)

        self.gridSizer1 = wxGridSizer(cols=2, hgap=0, rows=3, vgap=0)

        self.flexGridSizer1 = wxFlexGridSizer(cols=3, hgap=0, rows=3, vgap=0)

        self.staticBoxSizer1 = wxStaticBoxSizer(box=self.staticBox1,
              orient=wxVERTICAL)

        self.boxSizer2 = wxBoxSizer(orient=wxHORIZONTAL)

        self._init_coll_boxSizer1_Items(self.boxSizer1)
        self._init_coll_gridSizer1_Items(self.gridSizer1)
        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
        self._init_coll_staticBoxSizer1_Items(self.staticBoxSizer1)
        self._init_coll_boxSizer2_Items(self.boxSizer2)

        self.panel1.SetSizer(self.boxSizer1)
        self.panel2.SetSizer(self.gridSizer1)
        self.panel3.SetSizer(self.flexGridSizer1)
        self.panel4.SetSizer(self.staticBoxSizer1)

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt,
              pos=wxPoint(178, 91), size=wxSize(458, 307),
              style=wxDEFAULT_FRAME_STYLE, title='Sizer demo')
        self.SetClientSize(wxSize(450, 280))

        self.notebook1 = wxNotebook(id=wxID_WXFRAME1NOTEBOOK1, name='notebook1',
              parent=self, pos=wxPoint(0, 0), size=wxSize(450, 280), style=0)

        self.panel1 = wxPanel(id=wxID_WXFRAME1PANEL1, name='panel1',
              parent=self.notebook1, pos=wxPoint(0, 0), size=wxSize(442, 254),
              style=wxTAB_TRAVERSAL)

        self.button1 = wxButton(id=wxID_WXFRAME1BUTTON1, label='button1',
              name='button1', parent=self.panel1, pos=wxPoint(0, 0),
              size=wxSize(75, 23), style=0)

        self.button2 = wxButton(id=wxID_WXFRAME1BUTTON2, label='button2',
              name='button2', parent=self.panel1, pos=wxPoint(183, 69),
              size=wxSize(75, 185), style=0)

        self.button3 = wxButton(id=wxID_WXFRAME1BUTTON3, label='button3',
              name='button3', parent=self.panel1, pos=wxPoint(367, 46),
              size=wxSize(75, 23), style=0)

        self.panel2 = wxPanel(id=wxID_WXFRAME1PANEL2, name='panel2',
              parent=self.notebook1, pos=wxPoint(0, 0), size=wxSize(442, 254),
              style=wxTAB_TRAVERSAL)

        self.button4 = wxButton(id=wxID_WXFRAME1BUTTON4, label='button4',
              name='button4', parent=self.panel2, pos=wxPoint(0, 0),
              size=wxSize(75, 23), style=0)

        self.button5 = wxButton(id=wxID_WXFRAME1BUTTON5, label='button5',
              name='button5', parent=self.panel2, pos=wxPoint(221, 0),
              size=wxSize(75, 23), style=0)

        self.button6 = wxButton(id=wxID_WXFRAME1BUTTON6, label='button6',
              name='button6', parent=self.panel2, pos=wxPoint(0, 84),
              size=wxSize(75, 23), style=0)

        self.button7 = wxButton(id=wxID_WXFRAME1BUTTON7, label='button7',
              name='button7', parent=self.panel2, pos=wxPoint(221, 84),
              size=wxSize(75, 23), style=0)

        self.button8 = wxButton(id=wxID_WXFRAME1BUTTON8, label='button8',
              name='button8', parent=self.panel2, pos=wxPoint(0, 168),
              size=wxSize(75, 23), style=0)

        self.button9 = wxButton(id=wxID_WXFRAME1BUTTON9, label='button9',
              name='button9', parent=self.panel2, pos=wxPoint(221, 168),
              size=wxSize(75, 23), style=0)

        self.panel3 = wxPanel(id=wxID_WXFRAME1PANEL3, name='panel3',
              parent=self.notebook1, pos=wxPoint(0, 0), size=wxSize(442, 254),
              style=wxTAB_TRAVERSAL)

        self.panel4 = wxPanel(id=wxID_WXFRAME1PANEL4, name='panel4',
              parent=self.notebook1, pos=wxPoint(0, 0), size=wxSize(442, 254),
              style=wxTAB_TRAVERSAL)

        self.staticBox1 = wxStaticBox(id=wxID_WXFRAME1STATICBOX1,
              label='staticBox1', name='staticBox1', parent=self.panel4,
              pos=wxPoint(0, 0), size=wxSize(442, 254), style=0)

        self.button10 = wxButton(id=wxID_WXFRAME1BUTTON10, label='button10',
              name='button10', parent=self.panel3, pos=wxPoint(10, 10),
              size=wxSize(75, 23), style=0)

        self.button11 = wxButton(id=wxID_WXFRAME1BUTTON11, label='button11',
              name='button11', parent=self.panel3, pos=wxPoint(105, 10),
              size=wxSize(75, 23), style=0)

        self.button12 = wxButton(id=wxID_WXFRAME1BUTTON12, label='button12',
              name='button12', parent=self.panel3, pos=wxPoint(200, 10),
              size=wxSize(75, 23), style=0)

        self.button13 = wxButton(id=wxID_WXFRAME1BUTTON13, label='button13',
              name='button13', parent=self.panel3, pos=wxPoint(10, 53),
              size=wxSize(75, 23), style=0)

        self.button14 = wxButton(id=wxID_WXFRAME1BUTTON14, label='button14',
              name='button14', parent=self.panel3, pos=wxPoint(105, 53),
              size=wxSize(75, 23), style=0)

        self.button15 = wxButton(id=wxID_WXFRAME1BUTTON15, label='button15',
              name='button15', parent=self.panel3, pos=wxPoint(200, 53),
              size=wxSize(75, 23), style=0)

        self.button16 = wxButton(id=wxID_WXFRAME1BUTTON16, label='button16',
              name='button16', parent=self.panel4, pos=wxPoint(183, 21),
              size=wxSize(75, 23), style=0)

        self.button17 = wxButton(id=wxID_WXFRAME1BUTTON17, label='button17',
              name='button17', parent=self.panel4, pos=wxPoint(183, 44),
              size=wxSize(75, 174), style=0)

        self.button18 = wxButton(id=wxID_WXFRAME1BUTTON18, label='button18',
              name='button18', parent=self.panel4, pos=wxPoint(183, 218),
              size=wxSize(75, 23), style=0)

        self.button19 = wxButton(id=wxID_WXFRAME1BUTTON19, label='button19',
              name='button19', parent=self.panel1, pos=wxPoint(100, 23),
              size=wxSize(75, 23), style=0)

        self.button20 = wxButton(id=wxID_WXFRAME1BUTTON20, label='button20',
              name='button20', parent=self.panel1, pos=wxPoint(183, 23),
              size=wxSize(75, 23), style=0)

        self.button21 = wxButton(id=wxID_WXFRAME1BUTTON21, label='button21',
              name='button21', parent=self.panel1, pos=wxPoint(266, 23),
              size=wxSize(75, 23), style=0)

        self._init_coll_notebook1_Pages(self.notebook1)

        self._init_sizers()

    def __init__(self, parent):
        self._init_ctrls(parent)

if __name__ == '__main__':
    app = wxPySimpleApp()
    wxInitAllImageHandlers()
    frame = create(None)
    frame.Show()

    app.MainLoop()
Riaan Booysen | 5 Aug 11:12 2003
Picon

Re: (no subject)

Hi Dini,

dini wahyuni wrote:
> hi all....
> i'm a newbie in Python especially boa-constructor. i want to ask u about build an aplication for database.
i need 
> use postgresql. so how can i connect with postgresql using boa ( i read boa-constructor's help that bc is 
> isnpired by delphi). so is it has same function like delphi to build a database application? if not how i can
use the 
> table from my database n display it in a grid (or something like that?).please if u cn tell me step by step,
coz 
> actually i dont so familar with bc.
> thanx for all of u before.
> ps :sorry if my english is not well.

At this stage Boa does not support DB aware controls like
Delphi, sorry.

It is a goal for some future release, but I cannot say
when yet.

Cheers,
Riaan.

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Eric Walstad | 6 Aug 18:29 2003
Picon

RE: New features

Hi Riaan,

Congratulations on getting Project of the Month at Source Forge and thanks
for telling me about it.  I enjoyed reading the article.  Successes like
this are part of what keeps the Python community thriving.  Thanks again
for your sharing your hard work and your innovations with all of us!

Best wishes for continued success,

Eric.
San Francisco, CA

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Marie-Laure Devambez | 11 Aug 15:52 2003

problem to hang out a script python

Hello,

I would like to do an interface with boa constructor where when we click on a button, this is hang out a script python. But I don't know how to hang out a script python, how to enter parameters and how to display the result of the program.
So can you help me please?
Thanks
 
M-L Devambez
Marius Trestioreanu | 11 Aug 16:17 2003
Picon

zope

Hi!

Sorry if this is already responded by the list. I cannot connect to 
localhost zope server from Boa. I get expat error:

unknown encoding: line 1, column 0.

I use Boa 0.2.3, Zope 2.6.1, Linux Mandrake.

Cheers,

--

-- 
Marius Trestioreanu 

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
sardaukar siet | 11 Aug 16:24 2003
Picon

error installing Boa 0.2.0


 Hi!

I got very excited about Boa 0.2.0 and wanted to check
it out, but after installing Python 2.3, wxPython
2.4.1.2 (non-Unicode) and Boa 0.2.0 on Windows XP SP1,
I get an error running Boa.py (and .pyc) about
'string' not being defined... I'll mail the error
message if no one else got this. Am I doing something
wrong?

I installed Python 2.3 on D:\Python23 and added this
directory to my PATH. Also, I chose to compile all
.py's tp .pyc's (I hope this is OK).

 Help! Thanks!

=====
Uproot your questions from their ground and the dangling roots will be seen. More questions!

Mentat Zensufi 
CH:D 220

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Rivaldo | 11 Aug 22:32 2003
Picon

Re:error installing Boa 0.2.0

This is a old problem, you need to upgrade to last version of 
Boa (0.2.4)

Rivaldo

> 
>  Hi!
> 
> I got very excited about Boa 0.2.0 and wanted to check
> it out, but after installing Python 2.3, wxPython
> 2.4.1.2 (non-Unicode) and Boa 0.2.0 on Windows XP SP1,
> I get an error running Boa.py (and .pyc) about
> 'string' not being defined... I'll mail the error
> message if no one else got this. Am I doing something
> wrong?
> 
> I installed Python 2.3 on D:\Python23 and added this
> directory to my PATH. Also, I chose to compile all
> .py's tp .pyc's (I hope this is OK).
> 
>  Help! Thanks!
> 
> 
> 
> =====
> Uproot your questions from their ground and the dangling roo
ts will be seen. More questions!
> 
> Mentat Zensufi 
> CH:D 220
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-
use web site design software
> http://sitebuilder.yahoo.com
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-
built ASP.NET sites including
> Data Reports, E-
commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NE
T.
> http://aspnet.click-
url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Boa-constructor-users mailing list
> Boa-constructor-users@...
> https://lists.sourceforge.net/lists/listinfo/boa-
constructor-users
> 

 
---
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis! 
http://antipopup.uol.com.br

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Riaan Booysen | 12 Aug 14:58 2003
Picon

Re: zope

Hi Marius,

Marius Trestioreanu wrote:
> Hi!
> 
> Sorry if this is already responded by the list. I cannot connect to 
> localhost zope server from Boa. I get expat error:
> 
> unknown encoding: line 1, column 0.
> 
> I use Boa 0.2.3, Zope 2.6.1, Linux Mandrake.

Someone else also reported a similar xmlrpclib problem.

I've improved my changes to xmlrpclib ;) to now use
the utf-8 encoding if sys.getdefaultencoding returns an
encoding not supported by expat.

The change is available in the 0.2.5 CVS release.

Cheers,
Riaan.

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

Gmane