Greetings; 11/01/2008
I am stepping thru: "Getting Started Guide for Boa Constructor
Kevin Gill November 1, 2000 March 2005 updated for Boa 0.4.0
July 2007 updated for Boa 0.6.0 by Werner F. Bruhin "
And everything works great, until I select the AboutMenu item.
It does absolutely nothing, as far as Dialog2 is concerned.
If I put some other code in 'AboutMenu' , instead of Dialog2 stuff, 'AboutMenu' works fine.
So I know that part of 'OnMenuHelpAboutMenu' is working.
Please, can someone tell me what is wrong with this code.
Thanks
...Vernon - #Boa:Frame:Frame2
-
-
import wx
-
#import Dialog2
-
-
def create(parent):
-
return Frame2(parent)
-
-
[wxID_FRAME2, wxID_FRAME2STATUSBAR1, wxID_FRAME2TEXTEDITOR,
-
] = [wx.NewId() for _init_ctrls in range(3)]
-
-
[wxID_FRAME2MENUFILECLOSE, wxID_FRAME2MENUFILEEXIT, wxID_FRAME2MENUFILEOPEN,
-
wxID_FRAME2MENUFILESAVE, wxID_FRAME2MENUFILESAVEAS,
-
] = [wx.NewId() for _init_coll_menuFile_Items in range(5)]
-
-
[wxID_FRAME2MENUHELPABOUT] = [wx.NewId() for _init_coll_menuHelp_Items in range(1)]
-
-
# ###################################################
-
def OnMenuHelpAboutMenu(self, event):
-
# if hasattr(sys, 'debugger_control'):
-
# sys.debugger_control.set_traceable()
-
dlg = Dialog2.Dialog2(self)
-
try:
-
dlg.ShowModal()
-
finally:
-
dlg.Destroy() # event.Skip()
-
# ###################################################
- #Boa:Dialog:Dialog2
-
-
import wx
-
-
def create(parent):
-
return Dialog2(parent)
-
-
[wxID_DIALOG2, wxID_DIALOG2BUTTON1, wxID_DIALOG2STATICBITMAP1,
-
wxID_DIALOG2STATICTEXT1, wxID_DIALOG2STATICTEXT2,
-
] = [wx.NewId() for _init_ctrls in range(5)]
-
-
class Dialog2(wx.Dialog):
-
def _init_ctrls(self, prnt):
-
# generated method, don't edit
-
wx.Dialog.__init__(self, id=wxID_Dialog2, name='', parent=prnt,
-
pos=wx.Point(604, 204), size=wx.Size(400, 398),
-
style=wx.DEFAULT_DIALOG_STYLE, title='About NoteBook')
-
self.SetClientSize(wx.Size(392, 364))
-
-
self.staticText1 = wx.StaticText(id=wxID_DIALOG2STATICTEXT1,
-
label='NoteBook - Simple Text Editor', name='staticText1',
-
parent=self, pos=wx.Point(80, 0), size=wx.Size(251, 23),
-
style=wx.ALIGN_CENTRE)
-
self.staticText1.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
-
False, 'Tahoma'))
-
-
self.staticText2 = wx.StaticText(id=wxID_DIALOG2STATICTEXT2,
-
label='This is my first Boa Contstructor application',
-
name='staticText2', parent=self, pos=wx.Point(40, 56),
-
size=wx.Size(309, 19), style=0)
-
self.staticText2.SetBackgroundColour(wx.Colour(255, 0, 0))
-
self.staticText2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
-
False, 'Tahoma'))
-
-
self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap(u'C:/Program Files/Python26/Boa Constructor/Practice/Boa.jpg',
-
wx.BITMAP_TYPE_JPEG), id=wxID_DIALOG2STATICBITMAP1,
-
name='staticBitmap1', parent=self, pos=wx.Point(80, 112),
-
size=wx.Size(236, 157), style=0)
-
-
self.button1 = wx.Button(id=wxID_DIALOG2BUTTON1, label='Close',
-
name='button1', parent=self, pos=wx.Point(168, 312),
-
size=wx.Size(75, 23), style=0)
-
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
-
id=wxID_DIALOG2BUTTON1)
-
-
def __init__(self, parent):
-
self._init_ctrls(parent)
-
-
def OnButton1Button(self, event):
-
self.Close() # event.Skip()
-
4 1441
You commented out "import Dialog2" at the top of your code...
You commented out "import Dialog2" at the top of your code...
Sorry, I don't know what you mean:
I see the code for both 'Boa:Frame:Frame2 ' and 'Boa:Dialog:Dialog2' .
I purposely left out extraneous code for because everythong works except Dialog2 .
Anyways I'll include it all here. -
#Boa:Frame:Frame2
-
-
import wx
-
#import Dialog2
-
-
def create(parent):
-
return Frame2(parent)
-
-
[wxID_FRAME2, wxID_FRAME2STATUSBAR1, wxID_FRAME2TEXTEDITOR,
-
] = [wx.NewId() for _init_ctrls in range(3)]
-
-
[wxID_FRAME2MENUFILECLOSE, wxID_FRAME2MENUFILEEXIT, wxID_FRAME2MENUFILEOPEN,
-
wxID_FRAME2MENUFILESAVE, wxID_FRAME2MENUFILESAVEAS,
-
] = [wx.NewId() for _init_coll_menuFile_Items in range(5)]
-
-
[wxID_FRAME2MENUHELPABOUT] = [wx.NewId() for _init_coll_menuHelp_Items in range(1)]
-
-
class Frame2(wx.Frame):
-
def _init_coll_menuBar1_Menus(self, parent):
-
# generated method, don't edit
-
-
parent.Append(menu=self.menuFile, title='File')
-
parent.Append(menu=self.menuHelp, title='Help')
-
-
def _init_coll_menuHelp_Items(self, parent):
-
# generated method, don't edit
-
-
parent.Append(help='Help is on the way...', id=wxID_FRAME2MENUHELPABOUT,
-
kind=wx.ITEM_NORMAL, text='About')
-
self.Bind(wx.EVT_MENU, self.OnMenuHelpAboutMenu,
-
id=wxID_FRAME2MENUHELPABOUT)
-
-
def _init_coll_menuFile_Items(self, parent):
-
# generated method, don't edit
-
-
parent.Append(help='Open a File...', id=wxID_FRAME2MENUFILEOPEN,
-
kind=wx.ITEM_NORMAL, text='Open')
-
parent.Append(help='Save File...', id=wxID_FRAME2MENUFILESAVE,
-
kind=wx.ITEM_NORMAL, text='Save')
-
parent.Append(help='Save File As...', id=wxID_FRAME2MENUFILESAVEAS,
-
kind=wx.ITEM_NORMAL, text='SaveAs')
-
parent.Append(help='Close File...', id=wxID_FRAME2MENUFILECLOSE,
-
kind=wx.ITEM_NORMAL, text='Close')
-
parent.Append(help='Exit Program...', id=wxID_FRAME2MENUFILEEXIT,
-
kind=wx.ITEM_NORMAL, text='Exit')
-
self.Bind(wx.EVT_MENU, self.OnMenuFileOpenMenu,
-
id=wxID_FRAME2MENUFILEOPEN)
-
self.Bind(wx.EVT_MENU, self.OnMenuFileSaveMenu,
-
id=wxID_FRAME2MENUFILESAVE)
-
self.Bind(wx.EVT_MENU, self.OnMenuFileSaveasMenu,
-
id=wxID_FRAME2MENUFILESAVEAS)
-
self.Bind(wx.EVT_MENU, self.OnMenuFileCloseMenu,
-
id=wxID_FRAME2MENUFILECLOSE)
-
self.Bind(wx.EVT_MENU, self.OnMenuFileExitMenu,
-
id=wxID_FRAME2MENUFILEEXIT)
-
-
def _init_coll_statusBar1_Fields(self, parent):
-
# generated method, don't edit
-
parent.SetFieldsCount(1)
-
-
parent.SetStatusText(number=0, text='status')
-
-
parent.SetStatusWidths([-1])
-
-
def _init_utils(self):
-
# generated method, don't edit
-
self.menuFile = wx.Menu(title='File')
-
-
self.menuHelp = wx.Menu(title='Help')
-
-
self.menuBar1 = wx.MenuBar()
-
-
self._init_coll_menuFile_Items(self.menuFile)
-
self._init_coll_menuHelp_Items(self.menuHelp)
-
self._init_coll_menuBar1_Menus(self.menuBar1)
-
-
def _init_ctrls(self, prnt):
-
# generated method, don't edit
-
wx.Frame.__init__(self, id=wxID_FRAME2, name='', parent=prnt,
-
pos=wx.Point(627, 173), size=wx.Size(400, 489),
-
style=wx.DEFAULT_FRAME_STYLE, title='Notebook')
-
self._init_utils()
-
self.SetClientSize(wx.Size(392, 455))
-
self.SetMenuBar(self.menuBar1)
-
-
self.statusBar1 = wx.StatusBar(id=wxID_FRAME2STATUSBAR1,
-
name='statusBar1', parent=self, style=0)
-
self._init_coll_statusBar1_Fields(self.statusBar1)
-
self.SetStatusBar(self.statusBar1)
-
-
self.textEditor = wx.TextCtrl(id=wxID_FRAME2TEXTEDITOR,
-
name='textEditor', parent=self, pos=wx.Point(0, 0),
-
size=wx.Size(392, 412), style=wx.TE_MULTILINE, value='')
-
-
def __init__(self, parent):
-
self._init_ctrls(parent)
-
self.FileName=None
-
-
def OnMenuFileOpenMenu(self, event):
-
dlg = wx.FileDialog(self, 'Choose a file', '.', '', '*.*', wx.OPEN)
-
try:
-
if dlg.ShowModal() == wx.ID_OK:
-
filename = dlg.GetPath()
-
# Your code
-
self.textEditor.LoadFile(filename)
-
self.FileName=filename
-
self.SetTitle(('Notebook - %s') % filename)
-
finally:
-
dlg.Destroy() # event.Skip()
-
-
def OnMenuFileSaveMenu(self, event):
-
if self.FileName == None:
-
return self.OnFileSaveasMenu(event)
-
else:
-
self.textEditor.SaveFile(self.FileName) # event.Skip()
-
-
def OnMenuFileSaveasMenu(self, event):
-
dlg = wx.FileDialog(self, 'Save file as', '.', '', '*.*', wx.SAVE)
-
try:
-
if dlg.ShowModal() == wx.ID_OK:
-
filename = dlg.GetPath()
-
# Your code
-
self.textEditor.LoadFile(filename)
-
self.FileName=filename
-
self.SetTitle(('Notebook - %s') % filename)
-
finally:
-
dlg.Destroy() # event.Skip()
-
-
def OnMenuFileCloseMenu(self, event):
-
self.textEditor.LoadFile(filename)
-
self.FileName=filename
-
self.SetTitle(('Notebook - %s') % filename) # event.Skip()
-
-
def OnMenuHelpAboutMenu(self, event):
-
# if hasattr(sys, 'debugger_control'):
-
# sys.debugger_control.set_traceable()
-
dlg = Dialog2.Dialog2(self)
-
try:
-
dlg.ShowModal()
-
finally:
-
dlg.Destroy() # event.Skip()
-
-
def OnMenuFileExitMenu(self, event):
-
self.Close() # event.Skip()
-
-
-
-
#Boa:Dialog:Dialog2
-
-
import wx
-
-
def create(parent):
-
return Dialog2(parent)
-
-
[wxID_DIALOG2, wxID_DIALOG2BUTTON1, wxID_DIALOG2STATICBITMAP1,
-
wxID_DIALOG2STATICTEXT1, wxID_DIALOG2STATICTEXT2,
-
] = [wx.NewId() for _init_ctrls in range(5)]
-
-
class Dialog2(wx.Dialog):
-
def _init_ctrls(self, prnt):
-
# generated method, don't edit
-
wx.Dialog.__init__(self, id=wxID_Dialog2, name='', parent=prnt,
-
pos=wx.Point(604, 204), size=wx.Size(400, 398),
-
style=wx.DEFAULT_DIALOG_STYLE, title='About NoteBook')
-
self.SetClientSize(wx.Size(392, 364))
-
-
self.staticText1 = wx.StaticText(id=wxID_DIALOG2STATICTEXT1,
-
label='NoteBook - Simple Text Editor', name='staticText1',
-
parent=self, pos=wx.Point(80, 0), size=wx.Size(251, 23),
-
style=wx.ALIGN_CENTRE)
-
self.staticText1.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
-
False, 'Tahoma'))
-
-
self.staticText2 = wx.StaticText(id=wxID_DIALOG2STATICTEXT2,
-
label='This is my first Boa Contstructor application',
-
name='staticText2', parent=self, pos=wx.Point(40, 56),
-
size=wx.Size(309, 19), style=0)
-
self.staticText2.SetBackgroundColour(wx.Colour(255, 0, 0))
-
self.staticText2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
-
False, 'Tahoma'))
-
-
self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap(u'C:/Program Files/Python26/Boa Constructor/Practice/Boa.jpg',
-
wx.BITMAP_TYPE_JPEG), id=wxID_DIALOG2STATICBITMAP1,
-
name='staticBitmap1', parent=self, pos=wx.Point(80, 112),
-
size=wx.Size(236, 157), style=0)
-
-
self.button1 = wx.Button(id=wxID_DIALOG2BUTTON1, label='Close',
-
name='button1', parent=self, pos=wx.Point(168, 312),
-
size=wx.Size(75, 23), style=0)
-
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
-
id=wxID_DIALOG2BUTTON1)
-
-
def __init__(self, parent):
-
self._init_ctrls(parent)
-
-
def OnButton1Button(self, event):
-
self.Close() # event.Skip()
-
-
Hope this helps, Thanks !
I'm talking about line 4 of your first codeblock:
There's a '#' there, thus this statement won't be executed, because it is regarded as a comment.
As a result of that, you cant call 'Dialog2.Dialog2()' (as you did on line 22), because the Dialog2-module hasn't been imported.
Ah, yes, that would cause problems.
I fixed that line.
Unfortunately, the program continues to not bring up Dialog2.
Any ideas?
Thanks!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Albert Wagner |
last post by:
I have a page with two frames. Frame1 contains an inline script. Frame2
contains inline and 2 loaded scripts. How may I call a function in
frame1(inline) from frame2(inline or loaded)?
Albert
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |