PhysicsWindow module

class PhysicsWindow.AddObjectWindow(window, event)[source]

Bases: PhysicsWindow.PhysicsWindow

Opens a new window with entry fields for adding a new PhysicsObject to the canvas.

Parameters
  • window (Ui.MainWindow) – The root window

  • event (Tk.MouseEvent ?) – A Mousevent

add_button_press()[source]

Executed when user clicks Add button.

Creates PhysicsObject, calls PhysicsCanvas.add_physics_object

Deltes and closes the window

class PhysicsWindow.PhysicsObjectWindow(window, physics_object, x=200, y=200)[source]

Bases: PhysicsWindow.PhysicsWindow

A window which tracks the status of a Physics.ForceObject, showing its current x, y, velocity, etc.

Also provides buttons for deleting the object and adding an “orbiter”

Parameters
  • window (Ui.MainWindow) – The main UI window

  • physics_object (Physics.ForceObject) – The ForceObject to track

  • x (number) – The screen x the window should appear

  • y (number) – The screen y the window should appear

delete_button()[source]

Called when user presses the delete button on the window.

Deletes the ForceObject and the PhysicsObjectWindow

Calls clear_forces on the Physics.ForceObject

orbiter_button()[source]

Adds a new ForceObject to the physics canvas. The new ForceObject is 1/100th the mass of the object this ForceWindow is already referencing. It starts 100 meters N of this ForceWindow’s ForceObject and has a western velocity. A Physics.GravitationalForceGenerator is also created to generate gravity between the two objects

update(interval)[source]

Updates the displayed information.

Updates less frequently than the framerate; only as often as specified in Options.py to improve performance

Parameters

interval (number) – Time in seconds

class PhysicsWindow.PhysicsWindow(window)[source]

Bases: object

Generated by Physics Canvas interactions, when some interaction should cause a new window to open which relates to something on the PhysicsCanvas.

Parameters

window (Ui.MainWindow) – The main UI window

del_win()[source]

Custom delete function also deletes window from Ui.Window update references

update(interval)[source]

Set interval in Options.py to control how often these windows update. :param interval: Time in seconds :type interval: number