Python Forum
Get variable from another class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get variable from another class
#1
Very new to Python and programming in general. I've watched videos and read tutorials about class variables, but I can't get it through my head how to make "selection" from FileType available in coordpick:

Would appreciate some help!

import arcpy
import pythonaddins

class FileType(object):
    """Implementation for pasdamappa_addin.filetype (ComboBox)"""
    def __init__(self):
        self.items = [".tif", ".jp2", ".sid"]
        self.editable = False
        self.enabled = True

    def onSelChange(self, selection):
        coordpick.enabled = True
        print selection

class coordpick(object):
    """Implementation for pasdamappa_addin.coordpick (Tool)"""
    def __init__(self):
        self.enabled = False
        self.shape = 'NONE'  # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.

    def onMouseDownMap(self, x, y, button, shift):
        print str(x)[:3] + str(y + 10000)[:2] + selection
Reply


Messages In This Thread
Get variable from another class - by Golfball2k6 - Apr-06-2019, 12:46 PM
RE: Get variable from another class - by ichabod801 - Apr-06-2019, 01:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable Types in a class nafshar 9 2,478 Oct-07-2022, 07:13 PM
Last Post: deanhystad
  can Inner Class reference the Outer Class's static variable? raykuan 6 5,931 Jul-01-2022, 06:34 AM
Last Post: SharonDutton
  Calling a base class variable from an inherited class CompleteNewb 3 1,697 Jan-20-2022, 04:50 AM
Last Post: CompleteNewb
  Can we access instance variable of parent class in child class using inheritance akdube 3 13,999 Nov-13-2020, 03:43 AM
Last Post: SalsaBeanDip
  Class variable / instance variable ifigazsi 9 4,319 Jul-28-2020, 11:40 AM
Last Post: buran
  Assignment of non-existing class variable is accepted - Why? DrZ 6 4,281 Jul-13-2020, 03:53 PM
Last Post: deanhystad
  Limiting valid values for a variable in a class WJSwan 5 3,656 Jul-06-2020, 07:17 AM
Last Post: Gribouillis
  Newbie: Help with variable selection in a class Slack86 5 2,737 Apr-07-2020, 08:41 PM
Last Post: jefsummers
  Using variable from a class in another .py script keegan_010 4 2,995 Mar-25-2020, 07:47 AM
Last Post: keegan_010
  How to access class variable? instances vs class drSlump 5 3,359 Dec-11-2019, 06:26 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020