#1
  1. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407

    while loops problem


    arg i been at this for a while now.... tring to figure out why is it that when i add a loop in my program the program wont load? or even when i add a for loop i get nothing back ( while loop is in OnInit ( ) )

    Code:
    class HtmlWindows ( wxHtmlWindow ):
    
        def __init__ ( self, Parant, ID, frame ):
            wxHtmlWindow.__init__ ( self, Parant, ID )
    
            self.SetBackgroundColour ( 'Black' )  
        
        def Data ( self, Data ):
        
            self.AppendToPage ( Data )
        
    
    class MyPanel ( wxPanel ):
    
        def __init__ ( self, Parant, ID, frame ):
            wxPanel.__init__ ( self, Parant, ID )
    
            self.frame  = frame
    
            self.html   = HtmlWindows ( self, -1, self.frame )
                        
            
            sizer   = wxBoxSizer ( wxVERTICAL )
            sizer.Add ( self.html, 1, wxGROW )
    
            subsizer     = wxBoxSizer ( wxHORIZONTAL )
            staticText   = wxStaticText ( self, -1, "Testing" )
            textCtrl     = wxTextCtrl ( self, -1, " " )
            
            subsizer.Add ( staticText, 0, wxGROW | wxALL, 1 )
            subsizer.Add ( textCtrl,   1, wxGROW | wxALL, 1 )
            
            sizer.Add ( subsizer, 0, wxGROW )
            
            self.SetSizer ( sizer )
            self.SetAutoLayout ( True )
    
            
    
    class MyFrame ( wxFrame ):
    
        def __init__ ( self, Parant, ID, Title ):
            wxFrame.__init__ ( self, Parant, ID, Title,
                                   style=wxCAPTION|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxTHICK_FRAME,
                                   size = ( 650, 400 ))
    
            self.Panel  = MyPanel ( self, -1, self )
    
            self.CentreOnScreen ( wxBOTH )
            
            #wxInitAllImageHandlers() 
            #img = wxImage ( 'folder.gif' )
            #img.LoadFile ( 'folder.gif', wxBITMAP_TYPE_GIF )
            
            self.CreateStatusBar ( 2 )
            self.SetStatusWidths ( [ -1, 150 ] )
            self.SetStatusText ( ctime( time( ) ), 1 )
    
            Menu     = wxMenu ( )
            Menu.Append ( ID_EXIT, '&Exit', 'Exit The Program' )
    
            MenuBar  = wxMenuBar ( )
            MenuBar.Append ( Menu, '&File' )
            
            self.SetMenuBar ( MenuBar )
    
            EVT_MENU ( self, ID_EXIT, self.ExitProgram )
    
        def ExitProgram ( self, event ):
            self.Close ( True )
            
    
         
    
    class MyApp ( wxApp ):
    
        def OnInit ( self ):
    
            Frame = MyFrame ( NULL, -1, '*:: xlordt ::*' )
    
            while 1:
                Frame.Panel.html.Data ( 'hmm' )
            Frame.Show ( True )
            self.SetTopWindow ( Frame )
    
            return True
    
    
    Win = MyApp ( 0 )
    Win.MainLoop ( )
    Last edited by xlordt; May 25th, 2004 at 11:53 PM.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    6
    Rep Power
    0
    while 1:
    Frame.Panel.html.Data ( 'hmm' )

    if this is a while True loop, how do you expect it to break;
    and if it is not going to break; how do you expect the program to get out of the OnInit method. i think there should be some terminating condition for the while loop

    bye
    Vikram
  4. #3
  5. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Originally Posted by softking
    while 1:
    Frame.Panel.html.Data ( 'hmm' )

    if this is a while True loop, how do you expect it to break;
    and if it is not going to break; how do you expect the program to get out of the OnInit method. i think there should be some terminating condition for the while loop

    bye
    Vikram
    No it has nothing to do with the loop beaking.. the problem was that wxPython does not work this way..i realized that i hade 2 choices either use wxYield ( ) or make it threaded.. so far i get the program to loop now.. but it loops to fast..as i am testing it to connect to an irc server.. so ya now i have another prog

IMN logo majestic logo threadwatch logo seochat tools logo