@@ -191,7 +191,6 @@ def getter(self, widget):
191
191
widget: A tkinter widget that will be scanned. Preferably the
192
192
turtle canvas.
193
193
"""
194
-
195
194
x = self .window .winfo_rootx () + widget .winfo_x ()
196
195
y = self .window .winfo_rooty () + widget .winfo_y ()
197
196
x1 = x + widget .winfo_width ()
@@ -200,16 +199,6 @@ def getter(self, widget):
200
199
image .save (f"{ self .image_folder } /frame_{ self .frame_count } .gif" )
201
200
202
201
def switch_focus (self , event , direction ):
203
- """Switch of focus between bodies.
204
-
205
- Tkinter event which is called by the arrow keys.
206
-
207
- Args:
208
- event: Mandatory tkinter event argument.
209
- direction: A string, either left or right, wich shows wich
210
- next body is selected.
211
- """
212
-
213
202
if direction == "left" :
214
203
self .solar_system .switch_focus ("previous" )
215
204
elif direction == "right" :
@@ -230,16 +219,6 @@ def toggle_pause(self):
230
219
self .pause_button .config (text = "pause" )
231
220
232
221
def mouse_off (self , event , button ):
233
- """Event to determine mouse release of different buttons.
234
-
235
- Tkinter event which is called by the arrow keys.
236
- Sets mouse_click arguments for specific buttons to False,
237
- thus ending the specific mouse button movement.
238
-
239
- Args:
240
- event: Mandatory tkinter event argument.
241
- button: Strings of either b1, b2 or b3 to determine the button.
242
- """
243
222
if button == "b1" :
244
223
self .mouse_click1 = False
245
224
elif button == "b2" :
@@ -248,16 +227,6 @@ def mouse_off(self, event, button):
248
227
self .mouse_click3 = False
249
228
250
229
def change_fov (self , event ):
251
- """Event to change the FOV.
252
-
253
- Tkinter event which is called by the middle mouse button.
254
- Activates the specific mouse click initiating the mouse movement and
255
- adds mouse change of position to the FOV value.
256
-
257
- Args:
258
- event: Mandatory tkinter event argument. Used to determine
259
- mouse movement.
260
- """
261
230
if not self .mouse_click2 :
262
231
self .old_y = event .y
263
232
self .mouse_click2 = True
@@ -271,16 +240,6 @@ def change_fov(self, event):
271
240
self .FOV = self .fov_range [1 ]
272
241
273
242
def rotation (self , event ):
274
- """Event to change the rotation.
275
-
276
- Tkinter event which is called by the right mouse button.
277
- Activates the specific mouse click initiating the mouse movement and
278
- adds mouse change of position to the x and y rotation.
279
-
280
- Args:
281
- event: Mandatory tkinter event argument. Used to determine
282
- mouse movement.
283
- """
284
243
if not self .mouse_click3 :
285
244
self .old_x = event .x
286
245
self .old_y = event .y
@@ -297,16 +256,6 @@ def rotation(self, event):
297
256
self .y_rotation = self .y_rot_range [1 ]
298
257
299
258
def offset (self , event ):
300
- """Event to change the x/y offset.
301
-
302
- Tkinter event which is called by the left mouse button.
303
- Activates the specific mouse click initiating the mouse movement and
304
- adds mouse change of position to the x and y position.
305
-
306
- Args:
307
- event: Mandatory tkinter event argument. Used to determine
308
- mouse movement.
309
- """
310
259
if not self .mouse_click1 :
311
260
self .old_x = event .x
312
261
self .old_y = event .y
@@ -318,15 +267,6 @@ def offset(self, event):
318
267
self .old_y = event .y
319
268
320
269
def mouse_scroll (self , event ):
321
- """Event to change the distance.
322
-
323
- Tkinter event which is called by the scroll wheel.
324
- Determines distance and therfore size of the object on the screen.
325
-
326
- Args:
327
- event: Mandatory tkinter event argument. Used to get the
328
- scroll distance to determine the change in distance.
329
- """
330
270
self .distance -= (event .delta ) * self .distance / 1000
331
271
if self .distance < 0 :
332
272
self .distance = 0
@@ -429,12 +369,6 @@ def draw_time(self, time):
429
369
self .data_pointer .write (text , align = "left" , font = self .font )
430
370
431
371
def reset (self ):
432
- """Method that reset 3d view variables.
433
-
434
- Resets transformation, distance and rotation variables to
435
- predetermined values. Determines distance and therfore size of
436
- the object on the screen.
437
- """
438
372
self .FOV = self .fov_range [2 ]
439
373
self .distance = self .default_dist
440
374
self .x_offset = 0
@@ -601,30 +535,11 @@ def draw_rot_cube(self):
601
535
self .pointer .write (coord [i ], align = "center" , font = self .font )
602
536
603
537
def draw_cm (self , cm_pos ):
604
- """Method that draws the center of mass.
605
-
606
- Method that draws the center of mass of the simulation.
607
-
608
- Args:
609
- cm_pos: Position of the center of mass.
610
- """
611
538
pos , f = self .get_screen_xy (* cm_pos )
612
539
if pos is not None :
613
540
self .draw_circle (self .pointer , pos , self .cm_rad , self .cm_color , self .cm_color )
614
541
615
542
def draw_circle (self , pointer , pos , rad , pencolor , fillcolor ):
616
- """Method that draws circles.
617
-
618
- Method that draws a circle for the system bodies and the
619
- center of mass. It uses turtle.circle.
620
-
621
- Args:
622
- pointer: Turtle pointer that draws the turtle.
623
- pos: Position of the circle.
624
- rad: Radius of the circle.
625
- pencolor: Color of the circle outline.
626
- fillcolor: Color of the circle.
627
- """
628
543
pointer .goto (pos )
629
544
pointer .fd (rad )
630
545
pointer .left (90 )
@@ -637,18 +552,6 @@ def draw_circle(self, pointer, pos, rad, pencolor, fillcolor):
637
552
pointer .up ()
638
553
639
554
def get_size_factor (self , body_type ):
640
- """Method that gets a size factor.
641
-
642
- Method that gets the size factor of simulation body. Used to
643
- scale the body and make it more visible in the simulation.
644
-
645
- Args:
646
- body_type: Type of simulation body.
647
-
648
- Returns:
649
- Either returns size factor of a certain body or 1 if
650
- the body is not known.
651
- """
652
555
if body_type is Sun :
653
556
return self .star_size_factor
654
557
elif body_type is Planet :
@@ -852,17 +755,6 @@ def update_program(self):
852
755
853
756
854
757
def ConvertSectoDay (n ):
855
- """Method that transforms a 3d point into 2d point.
856
-
857
- Method that converts an amount of seconds into a number of years,
858
- months, days, hours and seconds.
859
-
860
- Args:
861
- n: Amount of seconds.
862
-
863
- Returns:
864
- Tuple of years, days, hours, minutes and seconds.
865
- """
866
758
year = n // (365 * 24 * 3600 )
867
759
n %= (365 * 24 * 3600 )
868
760
day = n // (24 * 3600 )
0 commit comments