hi all…
please see my attached document…
Advanced thanks…
New Microsoft Word Document.doc (37 KB)
Murali kumar wrote:
hi all..
please see my attached document..
You cannot assume that everyone on this list owns a copy of Microsoft
Word. A substantial fraction of wxPython users run Linux or MacOS.
Further, even if they do have Word, it is somewhat foolish to open a
Word document from a sender you don't know, because of the chance of
viruses.
Send your messages as plain text, please.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Scenario:
In my application , a menu invoking a frame class.
It’s having a wx.notebook control like above. Each notebook page is
also a class. In loadprofile class i’m tried to load a configuration
file already created by application.
(when pressing load button, current selected config filename in a
listbox must be loaded for application.)
config file data must to be applied to my application object.
mainApp object —> Frame object ( wx.notebook )
>
Load profile class
>
(return config file or data to mainApp object in load button Event
handler function…)
- I don’t know how to return config file or data to mainApp object
when pressing load button. *
- Is it easy to return filename only and load the file’s data into
mainApp object in menu handler itself? *
Please suggest me right direction… and tell me how to do it?
Usually where I can get these informations… (suggest links and
books…)
In wxPython, each object is just a “normal” Python class instance. This
means you can add your own fields and methods to the class. Add a method
to the mainApp object that will handle updating the config file. This
method can either accept just the filename of the config file or the
entire config data, that decision is up to you. That method can then
retrieve the config data and update the mainApp object as appropriate.
<< how event handler function returns the data… i think that’s not possible…
now i got one clue that, it is easy to add mainApp object to the notebook widget constructor… so that we can make changes easily…
The frame instance can call this method of mainApp.
<< Explain this line a bit… i didn’t understand this line properly…
On Fri, Apr 10, 2009 at 5:59 PM, Mark Erbaugh mark@microenh.com wrote:
On Fri, 2009-04-10 at 14:12 +0530, Murali kumar wrote:
I hope this helps.
Mark
wxpython-users mailing list
Murali kumar wrote:
> Scenario:
> In my application , a menu invoking a frame class.
>
> It’s having a wx.notebook control like above. Each notebook page is
> also a class. In loadprofile class i'm tried to load a configuration
> file already created by application.
> (when pressing load button, current selected config filename in a
> listbox must be loaded for application.)
>
> config file data must to be applied to my application object.
>
> mainApp object ---> Frame object ( wx.notebook )
>
> >
>
> Load profile class
>
> >
>
> (return config file or data to mainApp object in load button Event
> handler function..)
>
> * I don’t know how to return config file or data to mainApp object
> when pressing load button. *
>
> * Is it easy to return filename only and load the file’s data into
> mainApp object in menu handler itself? *
>
> Please suggest me right direction.. and tell me how to do it?
>
> Usually where I can get these informations.. (suggest links and
> books..)In wxPython, each object is just a "normal" Python class instance.
This
means you can add your own fields and methods to the class. Add a
method
to the mainApp object that will handle updating the config file. This
method can either accept just the filename of the config file or the
entire config data, that decision is up to you. That method can then
retrieve the config data and update the mainApp object as appropriate.<< how event handler function returns the data.. i think that's not possible..
now i got one clue that, it is easy to add mainApp object to the notebook widget constructor.. so that we can make changes easily..
The frame instance can call this method of mainApp.<< Explain this line a bit.. i didn't understand this line properly..
I hope this helps.
Mark
I think what Mark was referring to was something like this:
<code>
from ConfigParser import ConfigParser
def MyApp(wx.App):
def __init__(self, redirect, filename):
wx.App.__init__(self, redirect, filename)
self.createMenu() # this method creates the menu
# call the loadConfig
self.loadConfig(filePath)
# call it with a button event
myBtn.Bind(wx.EVT_BUTTON, self.loadConfig)
def loadConfig(self, filePath):
# get values from config file
config = ConfigParser()
config.read(filepath)
# repeat for as many values as needed
someValue = config.get("configHeader", "someVal")
self.someWidget.SetValue(someValue)
</code>
Note: This is NOTE fully functional code!
You should read the wiki, look up the zetcode tutorials and buy Robin's book. They will help you better understand wxPython usage.
On Fri, Apr 10, 2009 at 5:59 PM, Mark Erbaugh <mark@microenh.com > <mailto:mark@microenh.com>> wrote:
On Fri, 2009-04-10 at 14:12 +0530, Murali kumar wrote:
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4001 (20090411) __________
The message was checked by ESET NOD32 Antivirus.
Thanks a lot for help…
On Sat, Apr 11, 2009 at 8:30 PM, Mike Driscoll mike@pythonlibrary.org wrote:
Murali kumar wrote:
On Fri, Apr 10, 2009 at 5:59 PM, Mark Erbaugh <mark@microenh.com mailto:mark@microenh.com> wrote:
On Fri, 2009-04-10 at 14:12 +0530, Murali kumar wrote: > Scenario: > In my application , a menu invoking a frame class. > > It’s having a wx.notebook control like above. Each notebook page is > also a class. In loadprofile class i'm tried to load a configuration > file already created by application. > (when pressing load button, current selected config filename in a > listbox must be loaded for application.) > > config file data must to be applied to my application object. > > > mainApp object ---> Frame object ( wx.notebook ) > > > > > Load profile class > > > > > (return config file or data to mainApp object in load button Event > handler function..) > > > * I don’t know how to return config file or data to mainApp object > when pressing load button. * > > > * Is it easy to return filename only and load the file’s data into > mainApp object in menu handler itself? * > > > Please suggest me right direction.. and tell me how to do it? > > Usually where I can get these informations.. (suggest links and > books..) In wxPython, each object is just a "normal" Python class instance. This means you can add your own fields and methods to the class. Add a method to the mainApp object that will handle updating the config file. This method can either accept just the filename of the config file or the entire config data, that decision is up to you. That method can then retrieve the config data and update the mainApp object as appropriate.
<< how event handler function returns the data… i think that’s not possible…
now i got one clue that, it is easy to add mainApp object to the notebook widget constructor.. so that we can make changes easily.. The frame instance can call this method of mainApp.
<< Explain this line a bit… i didn’t understand this line properly…
I hope this helps. Mark
I think what Mark was referring to was something like this:
from ConfigParser import ConfigParser
def MyApp(wx.App):
def init(self, redirect, filename):
wx.App.__init__(self, redirect, filename) self.createMenu() # this method creates the menu # call the loadConfig self.loadConfig(filePath) # call it with a button event myBtn.Bind(wx.EVT_BUTTON, self.loadConfig)
def loadConfig(self, filePath):
# get values from config file config = ConfigParser() config.read(filepath) # repeat for as many values as needed someValue = config.get("configHeader", "someVal") self.someWidget.SetValue(someValue)
Note: This is NOTE fully functional code!
You should read the wiki, look up the zetcode tutorials and buy Robin’s book. They will help you better understand wxPython usage.
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4001 (20090411) __________
The message was checked by ESET NOD32 Antivirus.
wxpython-users mailing list