Sizers VS window size

2005-02-22 Thread Deltones
Hi,

I'm trying to understand one of the wiki wxPython tutorial, and I must
admit I`m a bit baffled by sizers. If I run the following relevant
piece of code, I get the result I expect, i.e a 800x600 window being
opened (sorry for the formatting):

objFrame = MainWindow(None, -1, "Small Editor", (800, 600))

def __init__(self, parent, id, title, custom_size):
wx.Frame.__init__(self, parent, wx.ID_ANY, title, size =
custom_size,
  style = wx.DEFAULT_FRAME_STYLE |
wx.NO_FULL_REPAINT_ON_RESIZE)

However, if I add this part from the tutorial, I get a much smaller
window. Why is there an interference with the result I want when
adding the sizer code?

Here's the code:

# Sizer section to understand
self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
self.buttons = []

for nI in range(0, 6):
self.buttons.append(wx.Button(self, ID_BUTTON + nI, "Button &" +
`nI`))
self.sizer2.Add(self.buttons[nI], 1, wx.EXPAND)

self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.control, 1, wx.EXPAND)
self.sizer.Add(self.sizer2, 0, wx.EXPAND)

self.SetSizer(self.sizer)
self.SetAutoLayout(1)
self.sizer.Fit(self)
# End of sizer section

Thanks

Denis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sizers VS window size

2005-02-23 Thread Deltones
Brian Victor <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Deltones wrote:
> > However, if I add this part from the tutorial, I get a much smaller
> > window. Why is there an interference with the result I want when
> > adding the sizer code?
> [snip]
> > self.sizer.Fit(self)
> 
> As noted in the the docs for Fit(): "Tell the sizer to resize the window
> to match the sizer's minimal size."  Take this call out and the size
> should be as you expect.

Thanks Brian, that was it. I admit I'm having quite a lot of fun
learning the Python/wxPython combo, but man is there a lot of concepts
to grasp!

Denis
-- 
http://mail.python.org/mailman/listinfo/python-list


Pythoncard - Mistake in walkthrough?

2005-02-23 Thread Deltones
Hi all,

I'm just getting into Python/wxPython/Pythoncard and I'm trying the
tutorial from this page:
http://pythoncard.sourceforge.net/walkthrough1.html

Is it me who's totally dense or there's some sort of confusion with
this tutorial?

Here's what is said in the tutorial:

Open the file starter1.py in your Python-aware editor of choice. The
Python script is, as you'd expect, brief and to the point. Here's the
important part to focus on:

def on_menuFileExit_select(self, event):
pass


But here's the starter1.py code:

#!/usr/bin/python

from PythonCard import model

class Minimal(model.Background):
pass

if __name__ == '__main__':
app = model.Application(Minimal)
app.MainLoop()


As you can see, the on_menu line is not in the starter1.py original
script, so I guessed that it should be a part of the Minimal class.

Then the tutorial ask me to replace the on_menu "pass" line with:

result = dialog.alertDialog(self, 'It works!', 'Showing Off')

but when you run the script, it runs, but clicking on Exit does not
display any dialog box. I did change the import line to include
dialog.

Is there something I'm not seeing here or there is really a mistake
with the walkthrough?

Thanks

Denis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythoncard - Mistake in walkthrough?

2005-02-23 Thread Deltones
> As stated in the on-line WalkThrough, the information there was written for
> an older version of the program.
> 


Hi,

I understand, but the walkthrough I'm doing comes from the doc folder
of the latest windows package. I thought that the walkthrough were
updated to fit the newest version. Thanks though.

Denis
-- 
http://mail.python.org/mailman/listinfo/python-list