yes_or_no ( Parametric )
Also see :
Quick Notes- Startup code
param(module from whichyes_or_nois imported)- Using a text editor
In this script , no second or third argument are included in the
yes_or_no("...")function. The result is an OK-Cancel dialog that returns 1 (for " OK ") and 0 (for " Cancel ").# No second or third argument entered for yes_or_no. from param import yes_or_no response = yes_or_no("Do you want to continue") print(response)
![]()
Dialog that appears when the above script is Run . Pressing " OK " returns 1. " Cancel " returns 0. This next script marks as held (
mem1.MarkedForHold = "Held") the member (mem1) that the user selects usingMemberLocate(). A yes-no dialog then opens (response = yes_or_no("...")). The dialog returns 1 when the user presses the " Yes " button, causing the while test to remain true; the user is then prompted to select another member to mark as held. When the user presses " No ", the dialog returns 0 , and this causes the operation to end.# Updates "Member hold status" of each selected member. from member import MemberLocate from param import ClearSelection, yes_or_no response = 1 while response == 1: mem1 = MemberLocate("Select a member") mem1.MarkedForHold = "Held" mem1.Update() response = yes_or_no("Mark another member as held?") print("You have ended this operation.") ClearSelection()This next script has second and third arguments in the
yes_or_no()function. The second argument is "point" and returns "point" as a string. The third argument ispt3and returnsPoint(0, 0, 0), which is point 0, 0, 0 in the global coordinate system.# Buttons in dialog are "point" and (0, 0, 0). from point import PointLocate, Point from param import yes_or_no, Units Units("feet") # sets output to decimal inches pt1 = PointLocate("Locate a point") pt3 = Point (0, 0, 0) var = yes_or_no("From point or origin?", "point", pt3) if var is "point": pt2 = PointLocate("Locate another point") print(pt1.Distance(pt2)) else: print(pt1.Distance(pt3))
![]()
Dialog that appears when the above script is Run . Pressing " Point " returns point.0, 0, 0returnsPoint(0, 0, 0).