473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

BOA 'OnMenuHelpAboutMenu' Frame2 Dialog2

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


Expand|Select|Wrap|Line Numbers
  1. #Boa:Frame:Frame2
  2.  
  3. import wx
  4. #import Dialog2
  5.  
  6. def create(parent):
  7.     return Frame2(parent)
  8.  
  9. [wxID_FRAME2, wxID_FRAME2STATUSBAR1, wxID_FRAME2TEXTEDITOR, 
  10. ] = [wx.NewId() for _init_ctrls in range(3)]
  11.  
  12. [wxID_FRAME2MENUFILECLOSE, wxID_FRAME2MENUFILEEXIT, wxID_FRAME2MENUFILEOPEN, 
  13.  wxID_FRAME2MENUFILESAVE, wxID_FRAME2MENUFILESAVEAS, 
  14. ] = [wx.NewId() for _init_coll_menuFile_Items in range(5)]
  15.  
  16. [wxID_FRAME2MENUHELPABOUT] = [wx.NewId() for _init_coll_menuHelp_Items in range(1)]
  17.  
  18. # ###################################################
  19.     def OnMenuHelpAboutMenu(self, event):
  20.         # if hasattr(sys, 'debugger_control'):     
  21.         # sys.debugger_control.set_traceable() 
  22.         dlg = Dialog2.Dialog2(self)
  23.         try:
  24.             dlg.ShowModal()
  25.         finally:
  26.             dlg.Destroy()  #  event.Skip()
  27. # ###################################################
  28. #Boa:Dialog:Dialog2
  29.  
  30. import wx
  31.  
  32. def create(parent):
  33.     return Dialog2(parent)
  34.  
  35. [wxID_DIALOG2, wxID_DIALOG2BUTTON1, wxID_DIALOG2STATICBITMAP1, 
  36.  wxID_DIALOG2STATICTEXT1, wxID_DIALOG2STATICTEXT2, 
  37. ] = [wx.NewId() for _init_ctrls in range(5)]
  38.  
  39. class Dialog2(wx.Dialog):
  40.     def _init_ctrls(self, prnt):
  41.         # generated method, don't edit
  42.         wx.Dialog.__init__(self, id=wxID_Dialog2, name='', parent=prnt,
  43.               pos=wx.Point(604, 204), size=wx.Size(400, 398),
  44.               style=wx.DEFAULT_DIALOG_STYLE, title='About NoteBook')
  45.         self.SetClientSize(wx.Size(392, 364))
  46.  
  47.         self.staticText1 = wx.StaticText(id=wxID_DIALOG2STATICTEXT1,
  48.               label='NoteBook - Simple Text Editor', name='staticText1',
  49.               parent=self, pos=wx.Point(80, 0), size=wx.Size(251, 23),
  50.               style=wx.ALIGN_CENTRE)
  51.         self.staticText1.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
  52.               False, 'Tahoma'))
  53.  
  54.         self.staticText2 = wx.StaticText(id=wxID_DIALOG2STATICTEXT2,
  55.               label='This is my first Boa Contstructor application',
  56.               name='staticText2', parent=self, pos=wx.Point(40, 56),
  57.               size=wx.Size(309, 19), style=0)
  58.         self.staticText2.SetBackgroundColour(wx.Colour(255, 0, 0))
  59.         self.staticText2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
  60.               False, 'Tahoma'))
  61.  
  62.         self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap(u'C:/Program Files/Python26/Boa Constructor/Practice/Boa.jpg',
  63.               wx.BITMAP_TYPE_JPEG), id=wxID_DIALOG2STATICBITMAP1,
  64.               name='staticBitmap1', parent=self, pos=wx.Point(80, 112),
  65.               size=wx.Size(236, 157), style=0)
  66.  
  67.         self.button1 = wx.Button(id=wxID_DIALOG2BUTTON1, label='Close',
  68.               name='button1', parent=self, pos=wx.Point(168, 312),
  69.               size=wx.Size(75, 23), style=0)
  70.         self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
  71.               id=wxID_DIALOG2BUTTON1)
  72.  
  73.     def __init__(self, parent):
  74.         self._init_ctrls(parent)
  75.  
  76.     def OnButton1Button(self, event):
  77.         self.Close()  # event.Skip()
  78.  
Nov 1 '08 #1
4 1441
YarrOfDoom
1,247 Expert 1GB
You commented out "import Dialog2" at the top of your code...
Nov 1 '08 #2
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.
Expand|Select|Wrap|Line Numbers
  1. #Boa:Frame:Frame2
  2.  
  3. import wx
  4. #import Dialog2
  5.  
  6. def create(parent):
  7.     return Frame2(parent)
  8.  
  9. [wxID_FRAME2, wxID_FRAME2STATUSBAR1, wxID_FRAME2TEXTEDITOR, 
  10. ] = [wx.NewId() for _init_ctrls in range(3)]
  11.  
  12. [wxID_FRAME2MENUFILECLOSE, wxID_FRAME2MENUFILEEXIT, wxID_FRAME2MENUFILEOPEN, 
  13.  wxID_FRAME2MENUFILESAVE, wxID_FRAME2MENUFILESAVEAS, 
  14. ] = [wx.NewId() for _init_coll_menuFile_Items in range(5)]
  15.  
  16. [wxID_FRAME2MENUHELPABOUT] = [wx.NewId() for _init_coll_menuHelp_Items in range(1)]
  17.  
  18. class Frame2(wx.Frame):
  19.     def _init_coll_menuBar1_Menus(self, parent):
  20.         # generated method, don't edit
  21.  
  22.         parent.Append(menu=self.menuFile, title='File')
  23.         parent.Append(menu=self.menuHelp, title='Help')
  24.  
  25.     def _init_coll_menuHelp_Items(self, parent):
  26.         # generated method, don't edit
  27.  
  28.         parent.Append(help='Help is on the way...', id=wxID_FRAME2MENUHELPABOUT,
  29.               kind=wx.ITEM_NORMAL, text='About')
  30.         self.Bind(wx.EVT_MENU, self.OnMenuHelpAboutMenu,
  31.               id=wxID_FRAME2MENUHELPABOUT)
  32.  
  33.     def _init_coll_menuFile_Items(self, parent):
  34.         # generated method, don't edit
  35.  
  36.         parent.Append(help='Open a File...', id=wxID_FRAME2MENUFILEOPEN,
  37.               kind=wx.ITEM_NORMAL, text='Open')
  38.         parent.Append(help='Save File...', id=wxID_FRAME2MENUFILESAVE,
  39.               kind=wx.ITEM_NORMAL, text='Save')
  40.         parent.Append(help='Save File As...', id=wxID_FRAME2MENUFILESAVEAS,
  41.               kind=wx.ITEM_NORMAL, text='SaveAs')
  42.         parent.Append(help='Close File...', id=wxID_FRAME2MENUFILECLOSE,
  43.               kind=wx.ITEM_NORMAL, text='Close')
  44.         parent.Append(help='Exit Program...', id=wxID_FRAME2MENUFILEEXIT,
  45.               kind=wx.ITEM_NORMAL, text='Exit')
  46.         self.Bind(wx.EVT_MENU, self.OnMenuFileOpenMenu,
  47.               id=wxID_FRAME2MENUFILEOPEN)
  48.         self.Bind(wx.EVT_MENU, self.OnMenuFileSaveMenu,
  49.               id=wxID_FRAME2MENUFILESAVE)
  50.         self.Bind(wx.EVT_MENU, self.OnMenuFileSaveasMenu,
  51.               id=wxID_FRAME2MENUFILESAVEAS)
  52.         self.Bind(wx.EVT_MENU, self.OnMenuFileCloseMenu,
  53.               id=wxID_FRAME2MENUFILECLOSE)
  54.         self.Bind(wx.EVT_MENU, self.OnMenuFileExitMenu,
  55.               id=wxID_FRAME2MENUFILEEXIT)
  56.  
  57.     def _init_coll_statusBar1_Fields(self, parent):
  58.         # generated method, don't edit
  59.         parent.SetFieldsCount(1)
  60.  
  61.         parent.SetStatusText(number=0, text='status')
  62.  
  63.         parent.SetStatusWidths([-1])
  64.  
  65.     def _init_utils(self):
  66.         # generated method, don't edit
  67.         self.menuFile = wx.Menu(title='File')
  68.  
  69.         self.menuHelp = wx.Menu(title='Help')
  70.  
  71.         self.menuBar1 = wx.MenuBar()
  72.  
  73.         self._init_coll_menuFile_Items(self.menuFile)
  74.         self._init_coll_menuHelp_Items(self.menuHelp)
  75.         self._init_coll_menuBar1_Menus(self.menuBar1)
  76.  
  77.     def _init_ctrls(self, prnt):
  78.         # generated method, don't edit
  79.         wx.Frame.__init__(self, id=wxID_FRAME2, name='', parent=prnt,
  80.               pos=wx.Point(627, 173), size=wx.Size(400, 489),
  81.               style=wx.DEFAULT_FRAME_STYLE, title='Notebook')
  82.         self._init_utils()
  83.         self.SetClientSize(wx.Size(392, 455))
  84.         self.SetMenuBar(self.menuBar1)
  85.  
  86.         self.statusBar1 = wx.StatusBar(id=wxID_FRAME2STATUSBAR1,
  87.               name='statusBar1', parent=self, style=0)
  88.         self._init_coll_statusBar1_Fields(self.statusBar1)
  89.         self.SetStatusBar(self.statusBar1)
  90.  
  91.         self.textEditor = wx.TextCtrl(id=wxID_FRAME2TEXTEDITOR,
  92.               name='textEditor', parent=self, pos=wx.Point(0, 0),
  93.               size=wx.Size(392, 412), style=wx.TE_MULTILINE, value='')
  94.  
  95.     def __init__(self, parent):
  96.         self._init_ctrls(parent)
  97.         self.FileName=None  
  98.  
  99.     def OnMenuFileOpenMenu(self, event):
  100.         dlg = wx.FileDialog(self, 'Choose a file', '.', '', '*.*', wx.OPEN)
  101.         try:
  102.             if dlg.ShowModal() == wx.ID_OK:
  103.                 filename = dlg.GetPath()
  104.                 # Your code
  105.                 self.textEditor.LoadFile(filename) 
  106.                 self.FileName=filename
  107.                 self.SetTitle(('Notebook - %s') % filename)                 
  108.         finally:
  109.             dlg.Destroy() # event.Skip()
  110.  
  111.     def OnMenuFileSaveMenu(self, event):
  112.         if self.FileName == None:
  113.             return self.OnFileSaveasMenu(event)
  114.         else:
  115.             self.textEditor.SaveFile(self.FileName)  # event.Skip()
  116.  
  117.     def OnMenuFileSaveasMenu(self, event):
  118.         dlg = wx.FileDialog(self, 'Save file as', '.', '', '*.*', wx.SAVE)
  119.         try:
  120.             if dlg.ShowModal() == wx.ID_OK:
  121.                 filename = dlg.GetPath()
  122.                 # Your code
  123.                 self.textEditor.LoadFile(filename) 
  124.                 self.FileName=filename
  125.                 self.SetTitle(('Notebook - %s') % filename)                 
  126.         finally:
  127.             dlg.Destroy()  # event.Skip()
  128.  
  129.     def OnMenuFileCloseMenu(self, event):
  130.         self.textEditor.LoadFile(filename) 
  131.         self.FileName=filename
  132.         self.SetTitle(('Notebook - %s') % filename)  # event.Skip()
  133.  
  134.     def OnMenuHelpAboutMenu(self, event):
  135.         # if hasattr(sys, 'debugger_control'):     
  136.         # sys.debugger_control.set_traceable() 
  137.         dlg = Dialog2.Dialog2(self)
  138.         try:
  139.             dlg.ShowModal()
  140.         finally:
  141.             dlg.Destroy()  #  event.Skip()
  142.  
  143.     def OnMenuFileExitMenu(self, event):
  144.         self.Close()   # event.Skip()
  145.  
  146.  
  147.  
Expand|Select|Wrap|Line Numbers
  1. #Boa:Dialog:Dialog2
  2.  
  3. import wx
  4.  
  5. def create(parent):
  6.     return Dialog2(parent)
  7.  
  8. [wxID_DIALOG2, wxID_DIALOG2BUTTON1, wxID_DIALOG2STATICBITMAP1, 
  9.  wxID_DIALOG2STATICTEXT1, wxID_DIALOG2STATICTEXT2, 
  10. ] = [wx.NewId() for _init_ctrls in range(5)]
  11.  
  12. class Dialog2(wx.Dialog):
  13.     def _init_ctrls(self, prnt):
  14.         # generated method, don't edit
  15.         wx.Dialog.__init__(self, id=wxID_Dialog2, name='', parent=prnt,
  16.               pos=wx.Point(604, 204), size=wx.Size(400, 398),
  17.               style=wx.DEFAULT_DIALOG_STYLE, title='About NoteBook')
  18.         self.SetClientSize(wx.Size(392, 364))
  19.  
  20.         self.staticText1 = wx.StaticText(id=wxID_DIALOG2STATICTEXT1,
  21.               label='NoteBook - Simple Text Editor', name='staticText1',
  22.               parent=self, pos=wx.Point(80, 0), size=wx.Size(251, 23),
  23.               style=wx.ALIGN_CENTRE)
  24.         self.staticText1.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL,
  25.               False, 'Tahoma'))
  26.  
  27.         self.staticText2 = wx.StaticText(id=wxID_DIALOG2STATICTEXT2,
  28.               label='This is my first Boa Contstructor application',
  29.               name='staticText2', parent=self, pos=wx.Point(40, 56),
  30.               size=wx.Size(309, 19), style=0)
  31.         self.staticText2.SetBackgroundColour(wx.Colour(255, 0, 0))
  32.         self.staticText2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL,
  33.               False, 'Tahoma'))
  34.  
  35.         self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap(u'C:/Program Files/Python26/Boa Constructor/Practice/Boa.jpg',
  36.               wx.BITMAP_TYPE_JPEG), id=wxID_DIALOG2STATICBITMAP1,
  37.               name='staticBitmap1', parent=self, pos=wx.Point(80, 112),
  38.               size=wx.Size(236, 157), style=0)
  39.  
  40.         self.button1 = wx.Button(id=wxID_DIALOG2BUTTON1, label='Close',
  41.               name='button1', parent=self, pos=wx.Point(168, 312),
  42.               size=wx.Size(75, 23), style=0)
  43.         self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
  44.               id=wxID_DIALOG2BUTTON1)
  45.  
  46.     def __init__(self, parent):
  47.         self._init_ctrls(parent)
  48.  
  49.     def OnButton1Button(self, event):
  50.         self.Close()  # event.Skip()
  51.  
  52.  
Hope this helps, Thanks !
Nov 2 '08 #3
YarrOfDoom
1,247 Expert 1GB
I'm talking about line 4 of your first codeblock:
Expand|Select|Wrap|Line Numbers
  1. #import Dialog2
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.
Nov 2 '08 #4
Ah, yes, that would cause problems.
I fixed that line.
Unfortunately, the program continues to not bring up Dialog2.
Any ideas?
Thanks!
Nov 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

17
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
0
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
0
BarryA
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...
1
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...
0
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.