Thread: Python programming error question

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    1

    Angry Python programming error question

    I am studying wxpython right now and it keeps throwing the error message

    Traceback (most recent call last):
    File "C:\Python27\dat thing.py", line 20, in <module>
    frame=bucky(parent=None,id=-1)
    File "C:\Python27\dat thing.py", line 11, in __init__
    custom=wx.StaticText(panel, -1, "this is custom" (10,50))
    TypeError: 'str' object is not callable

    I went to the specified lines and found nothing wrong with them. this is what i have typed for it. Answer quickly please.


    import wx

    class bucky(wx.Frame):

    def __init__(self,parent,id):
    wx.Frame.__init__(self,parent,id,'Frame aka window', size=(300,200))
    panel=wx.Panel(self)

    wx.StaticText(panel, -1, "THIS IS SPARTAAAA", (10,10))

    custom=wx.StaticText(panel, -1, "this is custom" (10,50))
    custom.SetForegroundColour('white')
    custom.SetBackgroundColour('blue')




    if __name__=='__main__':
    app=wx.PySimpleApp()
    frame=bucky(parent=None,id=-1)
    frame.Show()
    app.MainLoop()

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    And you're asking here (and not on a board with "python" in the name) because....

    Notes on choosing a forum, and other useful tips
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Compare the arguments to StaticText in the following two lines:

    Code:
    wx.StaticText(panel, -1, "THIS IS SPARTAAAA", (10,10))
    
    custom=wx.StaticText(panel, -1, "this is custom" (10,50))
    Notice what's missing in the latter?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. is Python The best web programming language.
    By Nyah Check in forum Programming Book and Product Reviews
    Replies: 3
    Last Post: 03-17-2012, 09:12 PM
  2. Python mod sched question
    By Overworked_PhD in forum Tech Board
    Replies: 2
    Last Post: 04-26-2009, 03:16 PM
  3. python programming language
    By t3chn0n3rd in forum Tech Board
    Replies: 2
    Last Post: 01-16-2008, 01:50 AM
  4. Embedding Python - Link error
    By cboard_member in forum C++ Programming
    Replies: 0
    Last Post: 06-09-2006, 10:40 AM
  5. Python Programming language?
    By incognito in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 07-09-2002, 11:42 PM

Tags for this Thread