Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3243442
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:25:57+00:00 2026-05-17T18:25:57+00:00

I wrote the following code in python self._job = None #slider def sliderCallback(self): if

  • 0

I wrote the following code in python

self._job = None

#slider
def sliderCallback(self):
   if self._job:

And I get this error message

AttributeError: 'str' object has no attribute '_job'

why ? I thought I have initialized the variable before…

Update
Same issue with Timer variable

import Tkinter as tk
import vtk
from time import *
from threading import *
from vtk.tk import *
from Visualization import *
from Histogram import *
from ListItem import *

class UI(tk.Frame): 

    def build(self, root):

        #left column
        self.leftFrame = tk.Frame(root, width=400, height=550, bg="black") #.grid(column=4, row=0)
        self.leftFrame.pack(fill=tk.BOTH, expand=True, side=tk.LEFT)

        #right column
        self.rightFrame = tk.Frame(root, width=400, height=550, bg="black") #.grid(column=4, row=0)
        self.rightFrame.pack(fill=tk.BOTH, expand=True, side=tk.RIGHT)
        #self.rightBottomFrame = tk.Frame(rightFrame, width=400, height=550, bg="red") #.grid(column=4, row=0)

        #visualization
        self.vis = Visualization(self.rightFrame, 400, 350, tk.RIGHT)
        #self.vis.updateContourValue(400)

        #left column
        self.middleFrame = tk.Frame(root, width=400, height=550, bg="black") #.grid(column=0, columnspan=4, row=0)
        self.middleFrame.pack(fill=tk.Y, expand=True)

        #isosurfaces list
        def addItem(color, volume, surface):        
            listitem = ListItem(self.listFrame, color, volume, surface)

        self.listFrame = tk.Frame(self.middleFrame, width=400, height=500, bg="black") #.grid(column=0, columnspan=4, row=0)
        self.listFrame.pack(fill=tk.BOTH, expand=True, side=tk.TOP)
        addItem("#243", self.vis.getVolume(), self.vis.getSurface())

        #preview
        self.preview = Visualization(self.middleFrame, 200, 200, tk.BOTTOM)
        #self.preview.updateContourValue(1500)

        #histogram
        self.histFrame = Histogram(self.leftFrame, 400, 400, tk.TOP, self.preview.getData())


        #slider
        def updateValue(self):
            self.preview.updateContourValue(float(self.slider.get() ))
            print "updated value"

        self.timer = Timer(5.0, updateValue)

        def sliderCallback(self):
            self.timer.cancel()
            self.timer.start() # after 30 seconds, "hello, world" will be printed
            #if self._job:
                #root.after_cancel(self._job)
                #print "remove it"
            #self._job = root.after(500, self.updateValue)

        #def updateValue(value):
            #print('horizontal: {v}'.format(v=value))

        self.slider = tk.Scale(self.leftFrame, from_=0, to=256, orient=tk.HORIZONTAL, command=sliderCallback) #.grid(column=0, columnspan=3, row=1)
        self.slider.pack(in_=self.leftFrame, fill=tk.X)
        self.slider.set(200)

        #add Isosurface button
        def addIso():
            addItem("#243", self.vis.getVolume(), self.vis.getSurface())

        self.addButton = tk.Button(self.leftFrame, text="Add", command=addIso) #.grid(column=3, row=1)
        self.addButton.pack(in_=self.leftFrame, side="right", pady=2)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:25:58+00:00Added an answer on May 17, 2026 at 6:25 pm

    Edit:
    With your newly provided code, there does not seem to be the definition of self._job or _job in the class.

    Based on your current information, for some reason the function is receiving a string for self instead of an instance of the class you’ve defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C++Builder, I wrote the following code (in Button1Click handler), When I run in
I needed some simple string encryption, so I wrote the following code (with a
I've got the following bit of code (that another developer wrote) that I need
How can I write the following code quickly in emacs? \newcommand{\cA}{\mathcal A} \newcommand{\cB}{\mathcal B}
I am a AS3 novice learning PureMVC and want to write code following best
I have the following code: MemoryStream foo(){ MemoryStream ms = new MemoryStream(); // write
I am trying to use the following code to write data into an excel
I'm trying to write a piece of code that will do the following: Take
Wrote the following in PowersHell as a quick iTunes demonstration: $iTunes = New-Object -ComObject
I wrote the following javascript to put in my startup folder to work around

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.