boa and normal coding ?

  • steve smith

    steve smith - 2009-03-02

    i am following a book called python programming for absolute beginers. I cant get the following code to make a command box appear so as to give the user the message to hit enter. Its simple code, but will boa work with normal coding ?

    Print "game over"
    raw_input("\n\npress enter key to exit")

    Thats all the book says type in, it does work in idle but i really want to use boa for everything.

    I create a new module btw and that did not work as well creating a brand new python app...but still no joy ?

    Many thanks, steve.

    • Werner F. Bruhin


      Boa can run just about any Python code.  The one thing it has a problem with (due to the way it runs the code) is with things like raw_input, i.e. something which wants a response from stdin.

      Boa allows you to create GUI (using wxPython) and you could create a much nicer screen to show to the user that the game is over.

      Have a look at these:

      Ok, a lot more lines, but ...:

      import wx

      def create(parent):
          return Frame1(parent)

      ] = [wx.NewId() for _init_ctrls in range(3)]

      class Frame1(wx.Frame):
          def _init_coll_flexGridSizer1_Items(self, parent):
              # generated method, don't edit

              parent.AddWindow(self.staticText1, 0, border=10,

          def _init_coll_flexGridSizer1_Growables(self, parent):
              # generated method, don't edit


          def _init_sizers(self):
              # generated method, don't edit
              self.flexGridSizer1 = wx.FlexGridSizer(cols=0, hgap=0, rows=1, vgap=0)



          def _init_ctrls(self, prnt):
              # generated method, don't edit
              wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
                    pos=wx.Point(600, 304), size=wx.Size(400, 250),
                    title=u'The main screen of the app')
              self.SetClientSize(wx.Size(384, 214))
              self.Bind(wx.EVT_CLOSE, self.OnFrame1Close)

              self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
                    pos=wx.Point(0, 0), size=wx.Size(384, 214),

              self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
                    label=u'this would be the main screen', name='staticText1',
                    parent=self.panel1, pos=wx.Point(121, 100), size=wx.Size(142, 13),


          def __init__(self, parent):

          def OnFrame1Close(self, event):
              dlg = wx.MessageDialog(self, 'Already finished playing?', 'Are you sure', wx.YES_NO | wx.ICON_QUESTION)
                  result = dlg.ShowModal()
                  if result == wx.ID_NO:

      if __name__ == '__main__':
          app = wx.PySimpleApp()
          frame = create(None)


    • Werner F. Bruhin

      Should have know better then to paste code into the message.

      Sourceforge doesn't handle the indentation, so the code needs manual edit to make it run.


    • steve smith

      steve smith - 2009-03-02

      So in short, boa is not able to replicate normal python coding in its simplist form ?

      This is a pity as i dont really want to use VB but it does work and its just isnt any good at cross platform.

      Cheers anyhow,

      • Werner F. Bruhin


        """So in short, boa is not able to replicate normal python coding in its simplist form ? """

        If you need and/or want to write mostly Python code which uses raw_input then Boa is probably not the right editor/ide for you.  Although I am not sure which editor lets you run this kind of code directly, I just checked UliPad which I use for some things and it has the same issue.

        I guess you would just need to have a command window open and run that kind of code outside the IDE/Editor or find one which reads the stdin.


      • Chelonian

        Chelonian - 2009-03-04

        > So in short, boa is not able to replicate normal python coding in its simplist form ?


        As Werner said, I don´t think this is the right way to look at it.  First, if you write a simple Python program using the Boa editor and then run it in an interactive shell environment--including the one that comes with Boa (so you could use the Boa shell or IDLE or others)--it will work as you want.  In this use, the editor is just an editor, not unlike Editra or Ulipad or whatever.  In this regard, Boa does what you want, as does all other decent code editors.

        For most applications, though, using raw input is not how users interact with their programs--they use a GUI.  One of Boa´s (many) strengths is the visual GUI builder.

        So, to answer your question above:  Boa IS able to replicate normal python coding in its simplest form, and a lot more, too.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks