@@ -1039,6 +1039,10 @@ def animate_blinking(self, interval, animate=True, blink_graphic=None, number_of
1039
1039
# Object Gliding Functions
1040
1040
def glide (self , dx , dy , time = 1 , easing_x = py_ease_linear (), easing_y = None , allow_duplicate = True ,
1041
1041
duplicates_metric = ("Time" , "Initial" , "Change" )):
1042
+
1043
+ if self .get_anchor () is None :
1044
+ raise GraphicsError ("\n \n GraphicsError: gliding functions unsupported for this object" )
1045
+
1042
1046
for metric in duplicates_metric :
1043
1047
if metric not in DUPLICATES_METRICS ["2D Animation" ]:
1044
1048
raise GraphicsError ("\n \n GraphicsError: Metric in duplicates_metric must be one of "
@@ -1066,7 +1070,9 @@ def glide(self, dx, dy, time=1, easing_x=py_ease_linear(), easing_y=None, allow_
1066
1070
f"(integer or float), not { time } " )
1067
1071
1068
1072
if len (self .animation_queues ["glide" ]) > 0 :
1069
- initial = self .animation_queues ["glide" ][- 1 ]["Initial" ] + self .animation_queues ["glide" ][- 1 ]["Change" ]
1073
+ initial = [
1074
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][0 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][0 ],
1075
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][1 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][1 ]]
1070
1076
start = self .animation_queues ["glide" ][- 1 ]["Start" ] + self .animation_queues ["glide" ][- 1 ]["Time" ]
1071
1077
else :
1072
1078
initial = self .anchor .copy ()
@@ -1090,6 +1096,9 @@ def glide(self, dx, dy, time=1, easing_x=py_ease_linear(), easing_y=None, allow_
1090
1096
def glide_x (self , dx , time = 1 , easing = py_ease_linear (), allow_duplicate = True ,
1091
1097
duplicates_metric = ("Time" , "Initial" , "Change" )):
1092
1098
1099
+ if self .get_anchor () is None :
1100
+ raise GraphicsError ("\n \n GraphicsError: gliding functions unsupported for this object" )
1101
+
1093
1102
for metric in duplicates_metric :
1094
1103
if metric not in DUPLICATES_METRICS ["1D Animation" ]:
1095
1104
raise GraphicsError ("\n \n GraphicsError: Metric in duplicates_metric must be one of "
@@ -1108,7 +1117,9 @@ def glide_x(self, dx, time=1, easing=py_ease_linear(), allow_duplicate=True,
1108
1117
f"not { allow_duplicate } " )
1109
1118
1110
1119
if len (self .animation_queues ["glide" ]) > 0 :
1111
- initial = self .animation_queues ["glide" ][- 1 ]["Initial" ] + self .animation_queues ["glide" ][- 1 ]["Change" ]
1120
+ initial = [
1121
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][0 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][0 ],
1122
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][1 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][1 ]]
1112
1123
start = self .animation_queues ["glide" ][- 1 ]["Start" ] + self .animation_queues ["glide" ][- 1 ]["Time" ]
1113
1124
else :
1114
1125
initial = self .anchor .copy ()
@@ -1131,6 +1142,10 @@ def glide_x(self, dx, time=1, easing=py_ease_linear(), allow_duplicate=True,
1131
1142
1132
1143
def glide_y (self , dy , time = 1 , easing = py_ease_linear (), allow_duplicate = True ,
1133
1144
duplicates_metric = ("Time" , "Initial" , "Change" )):
1145
+
1146
+ if self .get_anchor () is None :
1147
+ raise GraphicsError ("\n \n GraphicsError: gliding functions unsupported for this object" )
1148
+
1134
1149
for metric in duplicates_metric :
1135
1150
if metric not in DUPLICATES_METRICS ["1D Animation" ]:
1136
1151
raise GraphicsError ("\n \n GraphicsError: Metric in duplicates_metric must be one of "
@@ -1149,7 +1164,9 @@ def glide_y(self, dy, time=1, easing=py_ease_linear(), allow_duplicate=True,
1149
1164
f"not { allow_duplicate } " )
1150
1165
1151
1166
if len (self .animation_queues ["glide" ]) > 0 :
1152
- initial = self .animation_queues ["glide" ][- 1 ]["Initial" ] + self .animation_queues ["glide" ][- 1 ]["Change" ]
1167
+ initial = [
1168
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][0 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][0 ],
1169
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][1 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][1 ]]
1153
1170
start = self .animation_queues ["glide" ][- 1 ]["Start" ] + self .animation_queues ["glide" ][- 1 ]["Time" ]
1154
1171
else :
1155
1172
initial = self .anchor .copy ()
@@ -1173,6 +1190,9 @@ def glide_y(self, dy, time=1, easing=py_ease_linear(), allow_duplicate=True,
1173
1190
def glide_to (self , x , y , time = 1 , easing_x = py_ease_linear (), easing_y = None , allow_duplicate = True ,
1174
1191
duplicates_metric = ("Time" , "Final" )):
1175
1192
1193
+ if self .get_anchor () is None :
1194
+ raise GraphicsError ("\n \n GraphicsError: gliding functions unsupported for this object" )
1195
+
1176
1196
for metric in duplicates_metric :
1177
1197
if metric not in DUPLICATES_METRICS ["2D Animation" ]:
1178
1198
raise GraphicsError ("\n \n GraphicsError: Metric in duplicates_metric must be one of "
@@ -1200,7 +1220,9 @@ def glide_to(self, x, y, time=1, easing_x=py_ease_linear(), easing_y=None, allow
1200
1220
f"(integer or float), not { time } " )
1201
1221
1202
1222
if len (self .animation_queues ["glide" ]) > 0 :
1203
- initial = self .animation_queues ["glide" ][- 1 ]["Initial" ] + self .animation_queues ["glide" ][- 1 ]["Change" ]
1223
+ initial = [
1224
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][0 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][0 ],
1225
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][1 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][1 ]]
1204
1226
start = self .animation_queues ["glide" ][- 1 ]["Start" ] + self .animation_queues ["glide" ][- 1 ]["Time" ]
1205
1227
else :
1206
1228
initial = self .anchor .copy ()
@@ -1223,6 +1245,9 @@ def glide_to(self, x, y, time=1, easing_x=py_ease_linear(), easing_y=None, allow
1223
1245
return self
1224
1246
1225
1247
def glide_to_x (self , x , time = 1 , easing = py_ease_linear (), allow_duplicate = True , duplicates_metric = ("Time" , "Final" )):
1248
+ if self .get_anchor () is None :
1249
+ raise GraphicsError ("\n \n GraphicsError: gliding functions unsupported for this object" )
1250
+
1226
1251
for metric in duplicates_metric :
1227
1252
if metric not in DUPLICATES_METRICS ["1D Animation" ]:
1228
1253
raise GraphicsError ("\n \n GraphicsError: Metric in duplicates_metric must be one of "
@@ -1241,7 +1266,9 @@ def glide_to_x(self, x, time=1, easing=py_ease_linear(), allow_duplicate=True, d
1241
1266
f"not { allow_duplicate } " )
1242
1267
1243
1268
if len (self .animation_queues ["glide" ]) > 0 :
1244
- initial = self .animation_queues ["glide" ][- 1 ]["Initial" ] + self .animation_queues ["glide" ][- 1 ]["Change" ]
1269
+ initial = [
1270
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][0 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][0 ],
1271
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][1 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][1 ]]
1245
1272
start = self .animation_queues ["glide" ][- 1 ]["Start" ] + self .animation_queues ["glide" ][- 1 ]["Time" ]
1246
1273
else :
1247
1274
initial = self .anchor .copy ()
@@ -1263,6 +1290,9 @@ def glide_to_x(self, x, time=1, easing=py_ease_linear(), allow_duplicate=True, d
1263
1290
return self
1264
1291
1265
1292
def glide_to_y (self , y , time = 1 , easing = py_ease_linear (), allow_duplicate = True , duplicates_metric = ("Time" , "Final" )):
1293
+ if self .get_anchor () is None :
1294
+ raise GraphicsError ("\n \n GraphicsError: gliding functions unsupported for this object" )
1295
+
1266
1296
for metric in duplicates_metric :
1267
1297
if metric not in DUPLICATES_METRICS ["1D Animation" ]:
1268
1298
raise GraphicsError ("\n \n GraphicsError: Metric in duplicates_metric must be one of "
@@ -1281,7 +1311,8 @@ def glide_to_y(self, y, time=1, easing=py_ease_linear(), allow_duplicate=True, d
1281
1311
f"not { allow_duplicate } " )
1282
1312
1283
1313
if len (self .animation_queues ["glide" ]) > 0 :
1284
- initial = self .animation_queues ["glide" ][- 1 ]["Initial" ] + self .animation_queues ["glide" ][- 1 ]["Change" ]
1314
+ initial = [self .animation_queues ["glide" ][- 1 ]["Initial" ][0 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][0 ],
1315
+ self .animation_queues ["glide" ][- 1 ]["Initial" ][1 ] + self .animation_queues ["glide" ][- 1 ]["Change" ][1 ]]
1285
1316
start = self .animation_queues ["glide" ][- 1 ]["Start" ] + self .animation_queues ["glide" ][- 1 ]["Time" ]
1286
1317
else :
1287
1318
initial = self .anchor .copy ()
@@ -1988,7 +2019,10 @@ def is_selected(self):
1988
2019
return selected or self .selected_clicks == self .graphwin .total_left_mouse_clicks
1989
2020
1990
2021
def is_clicked (self , mouse_pos ):
1991
- return False
2022
+ if self .bounds is None :
2023
+ return False
2024
+ else :
2025
+ return self .bounds .is_clicked (mouse_pos )
1992
2026
1993
2027
# -------------------------------------------------------------------------
1994
2028
# STATIC METHODS
0 commit comments