[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] wxPython Message Window returns in Pygame
- To: "pygame-users@xxxxxxxx" <pygame-users@xxxxxxxx>
- Subject: [pygame] wxPython Message Window returns in Pygame
- From: "Ian Mallett" <geometrian@xxxxxxxxx>
- Date: Tue, 29 Jan 2008 21:54:49 -0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Wed, 30 Jan 2008 00:54:57 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=QghNTAIxVcpmp3DOiydVJ4PkNQgfvBpEggYEjREL4s0=; b=TuLLcNPue8GG8KKEPq+/F56fe91UvjviYi0uXePTlpiz8JnHSPS8K3hmNqsfScZl0EV0u5K6pC+vhF2903scJTLaD6xdAyZ9GBspI2mzj8Nl93TZE0O1ra9TXVN5x/ZZO7S+H9Wc+qp9o99hLQzSWcvuAwrALSg8TIDEom2RuOI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=FnV97qdeFssho2Xo6SAQUqWU+lm0tWl6oEeC6xJew9x9+w1yaEfh2+2FEEGjxCWU4MuGnuxejEKeNVGSbYLxym2M/lqUoHlCp/WOvRk8/EhS8sRRgNLzkF3RjuK476OAvPPw30LckaHDoJRZnSeRkQpltJehfjJUs8v98j7gfJ0=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi,
I've got a Pygame window from which a wxPython window pops up. One enters 5 values into 5 boxes, and then clicks OK. I want those return strings! Instead, when I print the returned value, I get '5100'. After the window exits, clicking on the print window causes a crash. Here's the code:
class EquationDialog(wx.Dialog):
def __init__(
self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition,
style=wx.DEFAULT_DIALOG_STYLE
):
pre = wx.PreDialog()
pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
pre.Create(parent, ID, title, pos, size, style)
self.PostCreate(pre)
sizer = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self, -1, "Enter the equation(s) to graph below.")
sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
for equation in range(5):
box = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1, str(equation+1)+": y = ")
box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
text = wx.TextCtrl(self, -1, "", size=(80,-1))
box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 5)
sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
btnsizer = wx.StdDialogButtonSizer()
if wx.Platform != "__WXMSW__":
btn = wx.ContextHelpButton(self)
btnsizer.AddButton(btn)
btn = wx.Button(self, wx.ID_OK)
## btn.SetHelpText("The OK button completes the dialog")
btn.SetDefault()
btnsizer.AddButton(btn)
btn = wx.Button(self, wx.ID_CANCEL)
## btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)")
btnsizer.AddButton(btn)
btnsizer.Realize()
sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
self.SetSizer(sizer)
sizer.Fit(self)app = wx.PySimpleApp()
dlg = EquationDialog(None, -1, "Set the Equation(s)", size=(350, 200),
#style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME
style = wx.DEFAULT_DIALOG_STYLE
)
dlg.CenterOnScreen()
val = dlg.ShowModal()
dlg.Destroy()
This last paragraph is actually in a function which is called by the main program. Again, the return, val, is something like 5100, no matter what I put in. Clicking on the console window causes a crash?!
Thanks,
Ian