[wxpython-users] three intern windows in one window

Abdessamad EL GON-NOUNI abdessamadg at gmail.com
Sun May 4 18:43:01 PDT 2008


thank you very much, but in my application panels will not communicate with
each other, but with other objects and methods. But the way panel are made
is I think what I want.
I have some questions about this:
-How can I specify the position and the size of a panel?
-is there any text field which is not StaticBox and not TextCtrl? because I
just want to display some messages and not to  write into it.
-In your example, the panel don't have there name, so how can you display
the name of the panel on his top?

2008/5/5 FT <chester_lab at fltg.net>:

>
> Hi!
>
>    Below is a small test example on communicating from one panel to
> another. Like the last question on the web about tabbing between panels
> you
> have to get a parent panel to talk to each other.
>    It would appear that you want 3 panels on the screen where one has
> message boxes and another that has buttons and such.
>    My example that runs as is and if you do not have the pyTTS engine,
> then
> delete it and it will still work.
>
>    You will note that the right panel must be placed in such a way to be
> able to communicate to. It just has an example of a text box but that is
> what you wanted on the right side. Messages and such.
>
>    You just have to get one panel the parent to all panels as children.
> This should be a good simple sample.
>
>    The 2 buttons are clicked on and each do a process based on what is
> given in the bind subroutine and such.
>
>    The sizer places each panel as you so desire. It can also be placed as
> a
> grid, what way you desire. The sizer is tied to the panel in
> control...panel.SetSizer(name4box)
>
>    I hope this helps. Just add another panel to run videos and such and it
> should work.
>
>        Bruce
>
> On Sun, May 4, 2008 at 7:33 PM, Abdessamad EL GON-NOUNI
> <abdessamadg at gmail.com> wrote:
> > hello,
> >     I'm making a graphic interface with wxpython and I want to have
> three
> > internal windows, one will display an image which changes every time,
> the
> > second will contain other wibdows which have buttons and text fields and
> the
> > third one is for showing some messages. I'm struggling with too many
> > tutorials and I found that flixBoxSizer is the best one for me but I
> didn't
> > understand very well how it works. I would like to have some help from
> you
> > please.
>
> Do you mean BoxSizer or FlexGridSizer?  In any case, maybe what might
> be good is to look at the sizers tutorial on the wiki, and then ask
> specific
> questions to the list about what you don't understand.  That tutorial and
> the
> examples in it is found here:
> http://wiki.wxpython.org/UsingSizers
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
>
>
> Description=3D"""
> Widgets communicate
> It is important to know, how widgets can communicate in application.
> Follow
> the example."""
> #!/usr/bin/python
> # communicate.py
> #HOW TO COMMUNICATE INSIDE A FRAME PANELS!
> import wx
> import pyTTS
> tts =3D pyTTS.Create()
> class LeftPanel(wx.Panel):
>    def __init__(self, parent, id):
>        wx.Panel.__init__(self, parent, id, style=3Dwx.BORDER_SUNKEN)
>        self.text =3D parent.GetParent().rightPanel.text
>        button1 =3D wx.Button(self, -1, '+', (10, 10))
>        button2 =3D wx.Button(self, -1, '-', (10, 60))
>        self.Bind(wx.EVT_BUTTON, self.OnPlus, id=3Dbutton1.GetId())
>        self.Bind(wx.EVT_BUTTON, self.OnMinus, id=3Dbutton2.GetId())
>    def OnPlus(self, event):
>        value =3D int(self.text.GetLabel())
>        value =3D value + 1
>        tts.Speak(value)
>        self.text.SetLabel(str(value))
>    def OnMinus(self, event):
>        value =3D int(self.text.GetLabel())
>        value =3D value - 1
>        tts.Speak(value)
>        self.text.SetLabel(str(value))
> class RightPanel(wx.Panel):
>    def __init__(self, parent, id):
>        wx.Panel.__init__(self, parent, id, style=3Dwx.BORDER_SUNKEN)
>        self.text =3D wx.StaticText(self, -1, '0', (40, 60))
> class Communicate(wx.Frame):
>    def __init__(self, parent, id, title):
>        wx.Frame.__init__(self, parent, id, title, size=3D(280, 200))
>        panel =3D wx.Panel(self, -1)
>        self.rightPanel =3D RightPanel(panel, -1)
>        leftPanel =3D LeftPanel(panel, -1)
>        hbox =3D wx.BoxSizer()
>        hbox.Add(leftPanel, 1, wx.EXPAND | wx.ALL, 5)
>        hbox.Add(self.rightPanel, 1, wx.EXPAND | wx.ALL, 5)
>        panel.SetSizer(hbox)
>        self.Centre()
>        self.Show(True)
> app =3D wx.App()
> Communicate(None, -1, 'widgets communicate')
> app.MainLoop()
>
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200805=
05/1af0fc24/attachment.htm


More information about the wxpython-users mailing list