Python programming error question

This is a discussion on Python programming error question within the Tech Board forums, part of the Community Boards category; I am studying wxpython right now and it keeps throwing the error message Traceback (most recent call last): File "C:\Python27\dat ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,649
    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, 12: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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21