Why is no Listbook created?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Why is no Listbook created?

merl em
Dear all,
 
why is no Listbook created when running the attached code? How to setup one if not in this way?
 
Thanks in advance for all help,
 
Merlem
 
 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

GLB1.py (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Why is no Listbook created?

Karsten Hilbert
On Fri, Jun 16, 2017 at 09:46:19AM +0200, merl em wrote:

> why is no Listbook created when running the attached code? How to setup one if
> not in this way?

For one thing, there's no class named "GregiListBook" available:

(it might need to be GListBook instead)

> import wx, wx.grid
>
> ad = {"Reihtit":
>       [
>           [['D'], ['1'], ['M'], ['M'], [''], [''], ['']],
>           [['D'], ['2'], ['H'], ['H'], ['Zik'], [''], ['']],
>           [['D'], ['3'], ['W'], ['W'], ['Wik'], [''], ['']],
>           [['D'], ['2'], ['D'], ['P'], ['Plk'], [''], ['']],
>           [['D'], [''], ['E'], ['W'], ['Kft'], [''], ['']]
>           ],
>       "Daten": [
>           [['Ea Ind'], [''], [''], [''], [''], ['']],
>           [[''], [''], ['H 2'], ['H 3'], [''], ['']],
>           [[''], ['C 2, D 1'], ['C 3, D 2, K 1'], ['C 4, S 3'], ['MW 1'], ['']],
>           [['H Ind'], [''], [''], [''], [''], ['']],
>           [[''], ['C 3'], [''], [''], [''], ['']]
>           ]}
>
>
> Gruppen = {"M": {"Kennung1": ["M"]},
>            "T": {"Kennung1": ["T"]},
>            "H": {"Kennung1": ["H"]},
>            "D": {"Kennung1": ["D"]},
>            "E": {"Kennung1": ["E"]}}
>
>
> class GLBFrame(wx.Frame):
>     def __init__(self, parent, id, title):
>         wx.Frame.__init__(self, parent, id, title = "GregiListBook")
>    
>         # # # Teil 1: das Datenpanel in seinem BoxSizer aufbauen
>         glbbox = wx.BoxSizer(wx.HORIZONTAL)
>         glb = GregiListBook(self, wx.ID_ANY)
                ^^^^^^^^^^^^^

>         glbbox.Add(glb, 1, wx.ALIGN_TOP)
>         self.SetSizer(glbbox)
>
>         self.Show()
>
>
> class GListBook(wx.Listbook):
>     def __init__(self, parent, id):
>         wx.Listbook.__init__(self, parent, id)
>
>         for reihnum, reihe in enumerate(ad["Reihtit"]):
>             # die dazugehörige Datenreihe ist jeweils
>             datenreihe = ad["Daten"][reihnum]
>             if reihe[0][0] != "L":
>                 neueSeite = wx.Panel(self, wx.ID_ANY)
>                 obersizer = wx.BoxSizer(wx.HORIZONTAL)
>                 for grp in ["M", "T", "H", "D", "E"]:
>                     mittelpanel = wx.Panel(self, wx.ID_ANY)
>                     mittelsizer = wx.BoxSizer(wx.VERTICAL)
>                     if reihe[2][0] in Gruppen[grp]["Kennung1"]:
>                         unterpanel = wx.Panel(self, wx.ID_ANY)
>                         if len(reihe) < len(datenreihe):
>                             gridlen = len(datenreihe)
>                         else:
>                             gridlen = len(reihe)
>
>                         eintragsizer = wx.GridBagSizer()
>                         for etn, etr in enumerate(reihe):
>                             eintragsizer.Add(wx.StaticText(self, wx.ID_ANY,
>                                                 str(etr)), (0, etn))
>                         for dtn, datetr in enumerate(datenreihe):
>                             eintragsizer.Add(wx.StaticText(self, wx.ID_ANY,
>                                                 str(datetr)), (1, dtn))
>
>                         unterpanel.SetSizer(eintragsizer)
>                         mittelsizer.Add(unterpanel)
>                     mittelpanel.SetSizer(mittelsizer)
>                     obersizer.Add(mittelpanel)
>                    
>                 neueSeite.SetSizer(obersizer)
>                 self.AddPage(neueSeite, str(reihnum))
>
> if __name__ == "__main__":
>
>     app = wx.App(0)
>     preframe = GLBFrame(None, -1, "GLB")  
>     app.MainLoop()
>


--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Why is no Listbook created?

merl em
Thanks. I fixed that.
 
 
 
 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

GLB1.py (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

please fix this stuff , look for sizers later

firefox
import wx, wx.grid

ad = {"Reihtit":
       [
           [['D'], ['1'], ['M'], ['M'], [''], [''], ['']],
           [['D'], ['2'], ['H'], ['H'], ['Zik'], [''], ['']],
           [['D'], ['3'], ['W'], ['W'], ['Wik'], [''], ['']],
           [['D'], ['2'], ['D'], ['P'], ['Plk'], [''], ['']],
           [['D'], [''], ['E'], ['W'], ['Kft'], [''], ['']]
           ],
       "Daten": [
           [['Ea Ind'], [''], [''], [''], [''], ['']],
           [[''], [''], ['H 2'], ['H 3'], [''], ['']],
           [[''], ['C 2, D 1'], ['C 3, D 2, K 1'], ['C 4, S 3'], ['MW
1'], ['']],
           [['H Ind'], [''], [''], [''], [''], ['']],
           [[''], ['C 3'], [''], [''], [''], ['']]
           ]}


Gruppen = {"M": {"Kennung1": ["M"]},
            "T": {"Kennung1": ["T"]},
            "H": {"Kennung1": ["H"]},
            "D": {"Kennung1": ["D"]},
            "E": {"Kennung1": ["E"]}}


class GLBFrame(wx.Frame):
     def __init__(self, parent, id, title):
         wx.Frame.__init__(self, parent, id, title = "GregiListBook")

         # # # Teil 1: das Datenpanel in seinem BoxSizer aufbauen
         #glbbox = wx.BoxSizer(wx.HORIZONTAL)
         glb = GListBook2(self, wx.ID_ANY)  ##    glb =
GregiListBook(self, wx.ID_ANY)
         #glbbox.Add(glb, 1, wx.ALIGN_TOP)
         #self.SetSizer(glbbox)
         self.Show()


class GListBook2(wx.Listbook):
     def __init__(self, parent, id):
         wx.Listbook.__init__(self, parent, id)
         for reihnum, reihe in enumerate(ad["Reihtit"]):
             # die dazugehoerige Datenreihe ist jeweils
             datenreihe = ad["Daten"][reihnum]
             if reihe[0][0] != "L":
                 neueSeite = wx.Panel(self, wx.ID_ANY)
                 obersizer = wx.BoxSizer(wx.HORIZONTAL)
                 for grp in ["M", "T", "H", "D", "E"]:
                     mittelpanel = wx.Panel(self, wx.ID_ANY)
                     mittelsizer = wx.BoxSizer(wx.VERTICAL)
                     if reihe[2][0] in Gruppen[grp]["Kennung1"]:
                         unterpanel = wx.Panel(self, wx.ID_ANY)
                         if len(reihe) < len(datenreihe):
                             gridlen = len(datenreihe)
                         else:
                             gridlen = len(reihe)

                         eintragsizer = wx.GridBagSizer()
                         for etn, etr in enumerate(reihe):
                             eintragsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                                 str(etr)), (0, etn))
                         for dtn, datetr in enumerate(datenreihe):
                             eintragsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                                 str(datetr)), (1, dtn))

                         unterpanel.SetSizer(eintragsizer)
                         mittelsizer.Add(unterpanel)
                     mittelpanel.SetSizer(mittelsizer)
                     obersizer.Add(mittelpanel)

                 neueSeite.SetSizer(obersizer)
                 self.AddPage(neueSeite, str(reihnum))

if __name__ == "__main__":
     app = wx.App(0)
     preframe = GLBFrame(None, -1, "GLB")
     app.MainLoop()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: please fix this stuff , look for sizers later

firefox
und am besten die ö's weglassen

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: please fix this stuff , look for sizers later

merl em
In reply to this post by firefox
Could you please specify "this stuff"?
 
Maybe I provided a fixed version about that already?
 
Many thanks for all help,
Merlem

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: please fix this stuff , look for sizers later

firefox
> Could you please specify "this stuff"?
> Maybe I provided a fixed version about that already?

if you "fixed" it, it does not look like a fix to me.

the window does not display properly, obviously.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: please fix this stuff , look for sizers later

merl em
Maybe it wasn't clear enough that I need help.
Is there any possibility to get some information about *WHAT* makes the Listbook not being displayed properly?
 
I added a code Version without 'ö' if that makes it more possible to handle that main problem.
 
Thanks in advance,
Merlem

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

GLB2.py (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Why is no Listbook created?

Tim Roberts
In reply to this post by merl em
merl em wrote:
>  
> why is no Listbook created when running the attached code? How to
> setup one if not in this way?

You have a lot of confusion here about the panel ownership.

But first, in GLBFrame.__init__, you aren't allowing the GListBook to
expand, so it's fixed at its minimum size.  You probably want to add
wx.EXPAND to the glbbox.Add call.  But, if you aren't going to add any
other controls to the frame, you don't need a sizer at all.  When a
window only contains one control, that control automatically expands to
fill the parent.  So, this works:

class GLBFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title = "GregiListBook")
        glb = GListBook(self, wx.ID_ANY)
        self.Show()

Next, in GListBook.__init__, the only controls you should be adding to
"self" are the notebook pages.  You need to look at each control and
figure out "who is the proper parent?  For example:

                neueSeite = wx.Panel(self, wx.ID_ANY)
                obersizer = wx.BoxSizer(wx.HORIZONTAL)
                for grp in ["M", "T", "H", "D", "E"]:
                    mittelpanel = wx.Panel(self, wx.ID_ANY)
                    mittelsizer = wx.BoxSizer(wx.VERTICAL)

The mittelpanel here should be a child of "neueSeite", not of "self".
Similarly:

                    if reihe[2][0] in Gruppen[grp]["Kennung1"]:
                        unterpanel = wx.Panel(self, wx.ID_ANY)

"unterpanel" here should probably be a child of "mittelpanel", not of
"self".  And finally:

                        for etn, etr in enumerate(reihe):
                            eintragsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                                str(etr)), (0, etn))
                        for dtn, datetr in enumerate(datenreihe):
                            eintragsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                                str(datetr)), (1, dtn))

The static text controls should probably be children of "unterpanel",
not of "self".

Once I make those changes, I do see the listbook.  The layout still
seems like it's not quite right, but you'll have to chase that yourself.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Why is no Listbook created?

merl em
Thank you very much! That was the solution I needed :-) .
 
About the expansion of the panel: I had presented only a fragment of code, and I eliminated everything that I considered 'distracting'. In the code itself, I add more sizers and several dozen, maybe lateron up to more than thousend entries to the notebook sheets. Then, I guess - or fear -, it's more probable that I will have to come back with another scrollbar issue than that I have to deal with 'smallness' ;-) .
 
Concerning the sizers, I learned that a strict change of a frame or panel and a sizer usually makes the least problems. So I setup this more or less 'mechanically' if I am unsure about why a problem arises.
 
And to ownership and parenthship: obviously that's still too much magic for me. Usually 'self' works, and the demo don't give comments about why the ownership is 'self' or something else in a certain case. So, I'm left with guesswork. I don't even know whether 'ownership' and 'parentship' are referring to the same here or not. Unfortunately, there is no topic in the docs or in the demo (as far as I can find) that discusses these things... so I can't just go and read until I am wiser...
 
But anyway, I learned at least some things now that I didn't know before. So many, many thanks!
 
Merlem

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Listbook created?

firefox
I created some listbooks but it looks so broken.

too bad wxw demos are C++ code only, instead of being pythonic.

Boa C. has listbooks for GUI designing but don't expect much stable
features there.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Listbook created?

Igor Korot
On Fri, Jun 16, 2017 at 3:44 PM,  <[hidden email]> wrote:
> I created some listbooks but it looks so broken.
>
> too bad wxw demos are C++ code only, instead of being pythonic.

What are you talking about?
wxPython saite has demo for downloads....

Thank you.

>
> Boa C. has listbooks for GUI designing but don't expect much stable features
> there.
>
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

wx ...

firefox
yeah, but wxw is not wxpy

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Why is no Listbook created?

Tim Roberts
In reply to this post by merl em
On Jun 16, 2017, at 12:01 PM, merl em <[hidden email]> wrote:
>  
> And to ownership and parenthship: obviously that's still too much magic for me. Usually 'self' works, and the demo don't give comments about why the ownership is 'self' or something else in a certain case. So, I'm left with guesswork.

It's not guesswork at all.  If control B is going to be managed by the sizer for control C, then control B has to have control C as its parent.  Except in some odd circumstances, a control cannot be moved outside of its parent.  So, if you have text controls that should be inside a panel, then they need to be owned by that panel.

Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Why is no Listbook created?

merl em
Thank you for the explanation. As soon as one gets a lecture, it becomes more clear, yes. At least if one knows what excatly is covered by the expression 'control' in phoenix. I don't - probably it's not only 'everything that is named wx....Control' but something more?
And as long as one cannot find anything about that in the docs (and until now, I wasn't able to find such a statement or definition there), one is left with guesswork...
 
Best greetings from
Merlem
 
 
17.06.2017, 09:11, "Tim Roberts" <[hidden email]>:

On Jun 16, 2017, at 12:01 PM, merl em <[hidden email]> wrote:

 
 And to ownership and parenthship: obviously that's still too much magic for me. Usually 'self' works, and the demo don't give comments about why the ownership is 'self' or something else in a certain case. So, I'm left with guesswork.


It's not guesswork at all. If control B is going to be managed by the sizer for control C, then control B has to have control C as its parent. Except in some odd circumstances, a control cannot be moved outside of its parent. So, if you have text controls that should be inside a panel, then they need to be owned by that panel.

Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.
 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.