wxNotebook on a wxPanel.. how?
I have a wxFrame. On it is a wxNotebook, the Notebook ctrl has 5 tabs (Each one is a wxPanel.) On one of the tab pages (panels) I want to add another notebook ctrl. I get no errors but nothing shows up on the panel.. why is that? If I add a button or checkbox to the sizer on that panel, it shows. A notebook ctrl just isn't visible. The code is below: I checked and AddPage() returns True Weird thing is I can see a little bit, like the corner of a button where the wxNotebook is supposed to start. class TabPage(wxPanel): def __init__(self, parent): wxPanel.__init__(self, parent, -1) self.nb = wxNotebook(self, -1) self.nb.AddPage(wxPanel(self.nb, -1), "Settings") sizer = wxBoxSizer(wxHORIZONTAL) sizer.Add(self.nb(self)) self.SetSizer(sizer) self.Layout() self.Fit() -- http://mail.python.org/mailman/listinfo/python-list
Re: wxNotebook on a wxPanel.. how?
The above code I pasted was not correct. I pasted an older version. The sizer.Add() line should of been sizer.Add(self.nb) -- omit the (self). but I fixed the problem. I had to change that same line to sizer.add(self.nb, 1, wxEXPAND|wxALL) -- http://mail.python.org/mailman/listinfo/python-list
Writing C readable bitfield structs?
How would I go about writing a bitfield that can be read by my C app? I want to pack a few bools into one int. I know an extended module exists (npstruct) which helps you do this but I want to do it manually or using one of the standard modules. -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing C readable bitfield structs?
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Cappy2112 <[EMAIL PROTECTED]> wrote: > >there is a bitfiled mainpulator class inthe Cookbook, but I don't > >understand his explanation, and the example given doesn't really show > >off the features of the class. > > I assume you're talking about the struct module? If you give an > example of the C struct you're trying to read/write, I could come up > with some sample code to do it. struct S { unsigned int a : 1; unsigned int b : 1; unsigned int c : 1; unsigned int d : 1; }; fread(from file (file written by Python app) into an instance of struct S) then I want it to be used as follows: if (instance.a) f(); if (instance.b) g(); struct S comes out to 4 on my arch. I do not want to use a new int for every member of struct S. -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing C readable bitfield structs?
Anyone have any idea? [EMAIL PROTECTED] wrote: > Roy Smith wrote: > > In article <[EMAIL PROTECTED]>, > > Cappy2112 <[EMAIL PROTECTED]> wrote: > > >there is a bitfiled mainpulator class inthe Cookbook, but I don't > > >understand his explanation, and the example given doesn't really > show > > >off the features of the class. > > > > I assume you're talking about the struct module? If you give an > > example of the C struct you're trying to read/write, I could come up > > with some sample code to do it. > > struct S { > unsigned int a : 1; > unsigned int b : 1; > unsigned int c : 1; > unsigned int d : 1; > }; > > fread(from file (file written by Python app) into an instance of struct > S) > then I want it to be used as follows: > if (instance.a) f(); > if (instance.b) g(); > struct S comes out to 4 on my arch. I do not want to use a new int for > every member of struct S. -- http://mail.python.org/mailman/listinfo/python-list