update of the control_values

Marco Scheuble wrote:

Hello list,

I'm writing to you, because no one could give me a solution for following problem.

I created a Notebook with several pages. On each page there is a Listbox and a Panel with some controls like TextCtrls and Comboboxes. In the listbox there are some records shown. By selecting one of those records, I want to update the values of that textCtrls and Comboboxes. Following code gives a strange behavior. Something happens (On the LeftTop a tiny grey space appears, when a record is selected), but the values were not updated.

Here is my method-code:
    def OnSelect(self, event):
        oid = self.geb_list.GetStringSelection()
        aktuell =
        for liste in self.data:
            if liste[1] == oid:
                aktuell = liste
                break

        self.SetValues(aktuell)
        panel = self.FindWindowById(110)
        panel.Refresh()

Maybe someone can help me?
Lots of thanks,
Wucher

It looks like you are iterating over some kind of sequence and when you find what you are looking for, you break out of the iteration and then pass said value to SetValues. What does SetValues do? It would be a lot easier to help if you made a sample app. See here for details:

http://wiki.wxpython.org/MakingSampleApps

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Hello,

Hi Mike and all others,

I attached the small version of my program, so you can run it, and maybe find the error.

The Problem is not, that the values aren’t updated. The problem is the update of the controls.

I see two main issues here.

  1. in your panel class you are creating a second panel and assigning children controls of the main panel to it as attributes.

self.panel = wx.Panel(self, 199)

self.panel.quote = wx.StaticText(self, …)

This would be the cause of the square you are seeing. The second panel you made really serves hno purpose so just get rid of it and assign the controls to attributes of your class.

self.quote = wx.StaticText(self, …)

  1. When you handle the event to update the values you are updating the list/dictionaries you have but not re-setting the values in the controls. They can’t update unless you tell them new values.

i.e) self.logger.SetValue(something)

Cody

···

On Thu, Dec 11, 2008 at 10:50 AM, Marco Scheuble Wucherikovtski@gmx.de wrote:

Hello Cody,

Great!
Thanks a lot
everything works fine !!!!

kind regards
Marco

-------- Original-Nachricht --------

···

Datum: Thu, 11 Dec 2008 11:01:43 -0600
Von: "Cody Precord" <codyprecord@gmail.com>
An: wxpython-users@lists.wxwidgets.org
Betreff: Re: [wxpython-users] update of the control_values

Hello,

On Thu, Dec 11, 2008 at 10:50 AM, Marco Scheuble > <Wucherikovtski@gmx.de>wrote:

> Hi Mike and all others,
>
> I attached the small version of my program, so you can run it, and maybe
> find the error.
> The Problem is not, that the values aren't updated. The problem is the
> update of the controls.

I see two main issues here.

1) in your panel class you are creating a second panel and assigning
children controls of the main panel to it as attributes.

self.panel = wx.Panel(self, 199)
self.panel.quote = wx.StaticText(self, ...)

This would be the cause of the square you are seeing. The second panel you
made really serves hno purpose so just get rid of it and assign the
controls
to attributes of your class.

self.quote = wx.StaticText(self, ...)

2) When you handle the event to update the values you are updating the
list/dictionaries you have but not re-setting the values in the controls.
They can't update unless you tell them new values.

i.e) self.logger.SetValue(something)

Cody

--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger