Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 18th, 2004, 12:09 PM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,547 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 h 35 m 38 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
wxTextCtrl ( )

for some reason my text box does not want to show, but if i was to remove the button then everything is fine.. does anyone know why?

Code:
import os
from wxPython.wx import *

EXIT_ID   = 0
ABOUT_ID  = 1
FILEP_ID  = 2

class myFrame ( wxFrame ):

	def __init__ ( self, Parant, Id, Title ):
		wxFrame.__init__ ( self, Parant, Id, Title,
                                   wxDefaultPosition, wxSize ( 650, 350 ))

                self.dirname = ""

                self.control = wxTextCtrl( self, 1, style = wxTE_MULTILINE )

		self.CreateStatusBar ( )
		self.SetStatusText ( 'Welcome Users' )

                self.button = wxButton ( self, 10, "Save", wxPoint ( 2, 275 ))

                myMenus  = wxMenu ( )

                myMenus.Append ( FILEP_ID, '&Open', 'Open a new file' )
 	        myMenus.Append ( ABOUT_ID, '&About', 'About This Program' )
		myMenus.Append ( EXIT_ID,  '&Exit', 'Exit The Program' )

		myMenuBar = wxMenuBar ( )
		myMenuBar.Append ( myMenus, '&File' )
		self.SetMenuBar ( myMenuBar )

               	EVT_MENU ( self, FILEP_ID, self.OpenFile )
		EVT_MENU ( self, ABOUT_ID, self.AboutFunc )
		EVT_MENU ( self, EXIT_ID, self.ExitFunc )


        def OpenFile ( self, event ):

		FileDialogz  = wxFileDialog ( self, 'Chose File', self.dirname,
                                               "", '*.*', wxOPEN )

		if FileDialogz.ShowModal ( ) == wxID_OK:

			self.filename = FileDialogz.GetFilename ( )
			self.dirname  = FileDialogz.GetDirectory ( )

			fopen  = open ( os.path.join ( self.dirname, self.filename ), 'r' )
                        self.control.SetValue ( fopen.read ( ))

			fopen.close ( )
			FileDialogz.Destroy ( )
	

	def AboutFunc ( self, event ):
		
		dlg = wxMessageDialog ( self, 'Program Created xlordt',
					      'About Us', wxOK | wxICON_INFORMATION )
		dlg.ShowModal ( )
		dlg.Destroy ( )	

	def ExitFunc ( self, event ):

		self.Close ( true )

class MyApp ( wxApp ):

    def OnInit ( self ):

        frame = myFrame ( NULL, -1, "Xlordt -- Editor" )
        frame.Show ( true )
        self.SetTopWindow ( frame )
        return true

app = MyApp ( 0 )
app.MainLoop ( )


Also when i try opening a file i get the following

Code:
Gdk-CRITICAL **: file gdkwindow.c: line 1390 (gdk_window_get_size): assertion `window != NULL' failed.

Last edited by xlordt : May 18th, 2004 at 12:14 PM.

Reply With Quote
  #2  
Old May 18th, 2004, 02:43 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,205 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 17 h 39 m 53 sec
Reputation Power: 262
I ran the code you posted and it worked fine on my system - Windows XP, Python 2.3.3 and wxPython 2.4.2.4

Sorry I can't help any further.

Dave - The Developers' Coach

Reply With Quote
  #3  
Old May 18th, 2004, 04:05 PM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,547 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 h 35 m 38 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
i got it working with wxPoint to set the possion on it.. but i have one more question.. if i started status bar on one class how do i send a value to it from another? is that possiable?

Reply With Quote
  #4  
Old May 18th, 2004, 04:31 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,205 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 17 h 39 m 53 sec
Reputation Power: 262
Quote:
Originally Posted by xlordt
i have one more question.. if i started status bar on one class how do i send a value to it from another? is that possiable?


wxFrame.GetStatusBar() will return the wxStatusBar object associated with the frame. So long as the other class can get hold of the frame object, it should be able to manipulate the status bar.

Dave - The Developers' Coach

Reply With Quote
  #5  
Old May 18th, 2004, 10:46 PM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,547 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 h 35 m 38 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
I tried it and i get an error,

Code:
TypeError: unbound method GetStatusBar() must be called with Frame instance as first argument (got nothing instead)


what im tring to do is.. in wxPanel, once you click on the go button it will show what you entered in wxTextCtrl ( ) in the statusbar

Code:
class myPanel ( wxPanel ):

	def __init__ ( self, Parant, Id, msg ):
		wxPanel.__init__ ( self, Parant, Id, wxDefaultPosition,
		                    wxSize ( 10, 50 ), wxRAISED_BORDER|wxTAB_TRAVERSAL )

	        wxFrame.GetStatusBar ( )

		self.text   = wxStaticText ( self, -1, msg, wxPoint ( 0, 5 ))
                self.text2  = wxTextCtrl ( self, 1, " ", wxPoint ( 50, 2 ), wxSize ( 300, 20 ))
		button = wxButton ( self, CLICK_TEXT, "Go", wxPoint ( 354, 2 ), wxSize ( 50, 20 ))

		EVT_BUTTON ( self, CLICK_TEXT, self.onClick )

	def onClick ( self, event ):

		self.SetStatusText ( event.GetString ( ))


class myFrame ( wxFrame ):

	def __init__ ( self, Parant, Id, Title ):
		wxFrame.__init__ ( self, Parant, Id, Title,
                                   wxDefaultPosition, wxSize ( 650, 350 ))

                self.dirname = ""

		self.CreateStatusBar ( )

                myMenus  = wxMenu ( )

                myMenus.Append ( FILEP_ID, '&Open', 'Open a new file' )
 	        myMenus.Append ( ABOUT_ID, '&About', 'About This Program' )
		myMenus.Append ( EXIT_ID,  '&Exit', 'Exit The Program' )


as you can see the statusbar starts in wxFrame then i tried to call it from wxPanel cause thats where the button is at

Reply With Quote
  #6  
Old May 19th, 2004, 02:45 AM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,205 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 17 h 39 m 53 sec
Reputation Power: 262
Sorry, I should have explained it better. You need to call the function on the object you created from a subclass of wxFrame, not on the wxFrame class itself.

In your example, I presume that the wxFrame object is the parent of the MyPanel class (passed to the constructor as "Parant"). If so, then calling Parant.GetStatusBar() should work.

Dave - The Developers' Coach

Reply With Quote
  #7  
Old May 19th, 2004, 12:17 PM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,547 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109548 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 h 35 m 38 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
Ok i got it working the way i want it will Netytan's help, but for some reason GetString ( ) was not working correct so instead i used GetValue ( ) and that worked well for me thanx

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > wxTextCtrl ( )


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway