Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 30th, 2005, 11:43 AM   #1
dnathe4th
Programmer
 
Join Date: Oct 2004
Posts: 32
Rep Power: 0 dnathe4th is on a distinguished road
Bound Method Error

the message reads:
<bound method MyFrame.UpdateNow of <__main__.MyFrame; proxy of C++ wxFrame instance at _00929500_p_wxFrame>>

UpdateNow is the function i'm trying to call. it doesnt actually error out, it writes that where i show "text", as in "text = unicode(self.UpdateNow)"

heres teh whole code

import urllib
import time
import math
import wx
import wx.grid

from wxPython.wx import *
from wxPython.grid import *

ID_ABOUT = 101
ID_EXIT  = 102

class XmlTableModel(wx.grid.PyGridTableBase):
    def __init__(self,headers,data):
        wx.grid.PyGridTableBase.__init__(self)
        self.headers = headers
        self.data = data

    def GetNumberRows(self):
        return len(self.data)

    def GetNumberCols(self):
        return len(self.headers)

    def RemoveData(self,rowNum):
        self.data.pop()
        self.GetView().ProcessTableMessage(wx.grid.GridTableMessage(self,wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, len(data), 1))

    def AddData(self,data):
        self.data.append(data)
        self.GetView().ProcessTableMessage(wx.grid.GridTableMessage(self,wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED,1))

    def IsEmptyCell(self, row, col):
        try:
            if self.data[row][col] != "":
                return True
            else:
                return False
        except:
            return False

    def GetValue(self, row, col):
        return self.data[row][col]

    def SetValue(self, row, col, value):
        self.data[row][col] = value

    def GetColLabelValue(self, col):
        return self.headers[col]

    def GetDefaultColLabelSize(self):
        return 100

    def GetRowLabelValue(self, row):
        return self.data[row][0]

#--------------------------------------------------------------

class MyFrame(wxFrame):
    def __init__(self, parent, ID, title):
        wxFrame.__init__(self, parent, ID, title,
                         wxDefaultPosition, wxSize(250, 150))
        menu = wxMenu()
        menu.Append(ID_ABOUT, "&About",
                    "More information about this program")
        menu.AppendSeparator()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)

        EVT_MENU(self, ID_ABOUT, self.OnAbout)
        EVT_MENU(self, ID_EXIT,  self.TimeToQuit)

	text = unicode(self.UpdateNow)

	self.panel = wxPanel(self, -1, size=(242,63))
        self.static = wxStaticText(self.panel, -1, text)
	self.sizer2 = wxBoxSizer(wxHORIZONTAL)
	self.sizer2.Add(self.panel, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE, 0)

        self.button1 = wxButton(self, -1, "Update Now", wxDLG_PNT(self, 80, 50), wxDLG_SZE(self, 55, 25))
	self.sizer3 = wxBoxSizer(wxHORIZONTAL)
	self.sizer3.Add(self.button1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)

	self.sizer = wxBoxSizer(wxVERTICAL)
	self.sizer.Add(self.sizer2, 1, wxEXPAND)
	self.sizer.Add(self.sizer3, 0, wxEXPAND)

        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)



        EVT_BUTTON(self, -1, self.OnRead_Now)


    def OnAbout(self, event):
	
	dlg = wxMessageDialog(self, "School News is a small program written by Dom Narducci, who has many a time "
					"gone down to the bus stop because he didn't know there was a delay.  This "
					"is for him, and any other absent-minded school goer.", "About Me", wxOK | wxICON_INFORMATION)
	dlg.ShowModal()
	dlg.Destroy()

    def OnRead_Now(self, event):

	text = unicode(self.UpdateNow)

        dlg = wxMessageDialog(self, text, "School News", wxOK | wxICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()


    def TimeToQuit(self, event):
        self.Close(true)

    def UpdateNow():
	sock = urllib.urlopen("http://www.region15.org/gi/marquee.htm")
	htmlSource = sock.read()
	sock.close()
	mes_begin = htmlSource[389:]
	Y = 0
	text = ""
	X = 0
	while Y == 0:
		new_token = mes_begin[X:X+1]
		if new_token == "\"":
			Y = 1
		else:
			text = text + new_token
			X = X+1
	return text


class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame(NULL, -1, "School News")
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = MyApp(0)
app.MainLoop()
__________________
&lt;CENTER&gt;<span style='font-size:17pt;line-height:100%'>My Homepage</span>&lt;/CENTER&gt;
dnathe4th is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:48 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC