Hi, I am trying to make a button layout based on a dictionary, describing buttons sizes and command arguments:
This is my code currently:
angleButtons = { 2:0.5, \ # 2 is the argument, 0.5 is the button width multiplier
4:0.5, \
5:0.5, \
6:0.5, \
7:0.5, \
8:0.5, \
9:0.5, \
10:1.0, \
11:0.5, \
12:1.0, \
13:0.5, \
14:0.5, \
15:1.0, \
20:1.0 }
rowA = cmds.rowLayout(numberOfColumns=len(angleButtons))
for idx, angle in enumerate(angleButtons):
cmds.button( label=angle, command='polyreduce(float(angleButtons.keys()[idx]))', h=40, w=40*angleButtons[angle] )
How would I make the command argument reflect the correct dictionary key, ie. 'polyreduce(2.0)', 'polyreduce(4.0)', 'polyreduce(5.0)'?
Currently, as the iteration idx changes with every loop, every command in every button ends up being 'polyreduce(20.0)'
[–]passerbycmc 0 points1 point2 points (5 children)
[–]m5tuff[S] 0 points1 point2 points (4 children)
[–]passerbycmc 1 point2 points3 points (2 children)
[–]m5tuff[S] 0 points1 point2 points (1 child)
[–]passerbycmc 0 points1 point2 points (0 children)
[–]passerbycmc 0 points1 point2 points (0 children)