albie0803
Alibre Super User
Code:
KeySizes = ['2x2', '3x3', '4x4', '5x5', '6x6', '8x7', '10x8', '12x8', '14x9', '16x10', '18x11', '20x12', '22x14', '25x14', '28x16', '32x18', '36x20', '40x22', '45x25', '50x28']
# called when an input changes in the dialog window
def InputChanged(Index, Value):
# size changed
if Index == 0:
global KS
KS = KeySizes[Value]
# called when user confirms selections
def SelectionMade(Values):
# get values
global KS
KS= KeySizes[Values[0]]
Win = Windows()
Options = []
Options.append([None, WindowsInputTypes.Label, 'Ok to accept or select desired size then Ok'])
Options.append(['Key Size', WindowsInputTypes.StringList, KeySizes, KN])
ValueC = Win.UtilityDialog('This will create a %d x %d Key - %d Deep' % (KW,KH,KD), 'Apply', SelectionMade, InputChanged, Options, 90)
if ValueC == None:
sys.exit()
KeySeatData = {}
KeySeatData[1] = [2, 2, 1, 0.16, '2x2']
KeySeatData[2] = [3, 3, 1.6, 0.16,'3x3']
KeySeatData[3] = [4, 4, 2.5, 0.16,'4x4']
CD = float(CylDia)
KW = float(KeySeatData[CylDiaRanCho][0]) #KW key width
KH = float(KeySeatData[CylDiaRanCho][1]) #KH key height
KD = float(KeySeatData[CylDiaRanCho][2]) #KD key depth
KR = float(KeySeatData[CylDiaRanCho][3]) #KR key radius
KN = KeySeatData[CylDiaRanCho][4] #KN key name
When I click apply I get: python list indices must be integer or slice, not none
What I am trying to do is put the sizes in a list and get a value back to use to read from the data list
Educate me please someone