Salabim

Latest version: v25.0.8

Safety actively analyzes 723400 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 28

24.0.14

- `sim.AnimateImage` has a new parameter: height. So, the image can be scaled according to the
height, rather than the width. If both width and height are specified, the aspect ratio might not be the same as the original image.

- `sim.Animate` now has two new parameters: height0 and height1. See above.

- The method `Pdf` is now available also under the name `Pmf` (probability mass function), which is technically more correct.
Also, `CumPdf` is now available under the name `CumPmf` (cumulative probability mass function). The manual is updated accordingly.
(Inspired by a comment by Cahyadi Nugraha)

- If either `Environment.width` or `Environment.height` was a float, some animation methods did not work properly. Fixed.

- When rendering an animation to video, pasting frames could make the program crash sometimes. Fixed.

- Explicit test whether OpenGL supports glut introduced. Explicit test for availabity of pyglet (required for pywavefront) introduced.

- Not so much a change in salabim itself:
A version of OpenGL (PyOpenGL) which supports glut (required for 3D salabim animations)
can now be pip installed: `pip install OpenGL-glut` (Windows Intel/AMD 64 bit only!).
This makes running 3D animations under Python 3.13 possible and
installation for other Python versions much easier. The documentation is updated with this information.
Also, from now on the documentation recommends installing an even older version of pyglet: `pip install pyglet==1.4.0`

24.0.13

- sim.ComponentGenerator can now also be used with a number of moments:


sim.ComponentGenerator(Ship, moments=(10, 20, 50))

This will generate Ships at t=10, t=20 and t=50. The times should be specified in the current time unit.
The moments do not have to be sorted.

Note that moment cannot be used together with at, delay, till,duration, number, iat,force_at, force_till, disturbance or equidistant

- This version introduces a new class: Event. This is a specialized Component, that is most useful as a timer, which performs
some action after a certain time. E.g.:

class Client(sim.Component):
def process(self):
timer = sim.Event(action= lambda: self.activate(), name='timer', delay=10)
self.hold(sim.Uniform(0,20))
timer.cancel() this can be done even is the action was taken and timer is a data component
if timer.action_taken():
print("balked, because I had to wait for 10 minutes")
return
print("do stuff ...")

For more information, see the section on events and the reference in the latest documentation.

- Canceling a data component does not result in an exception anymore. This can be useful to cancel a wake up event even if it
it already ended.

- When reading a font file, the fontfile was not closed, thus causing a warning message if run under Viktor.ai. Fixed.
(Inspired by a comment by Michiel Luyken)

24.0.12

- Using the `fill` parameter of `sim.Store` resulted in an error. Fixed.
- Alternative way of testing for running under *AnacondaCode*
- captured_stdout` is now cleared with a `sim.reset()` call, which is particularly useful for running under *AnacondaCode* and Pythonista
- Under *PythonInExcel* and *AnacondaCode*, `yieldless` is now False by default (as under *Pythonista*).

24.0.11

- salabim can now also run (including .gif video creation) under *AnacondaCode* (Excel extension). The functionality is essentially
the same as running under *PythonInExcel*.

24.0.10

- When PySimpleGUI was installed with
pip install PySimpleGUI-4-Foss

sometimes an error occurred. Fixed.

- In version 24.0.9 the dynamic argument could be already object, but was not documented.
If the value of the parameter is `object` , this refers to the animation object itself. So, we can say


sim.AnimateText(text="Hello", x=lambda t: t * 10, y=lambda t, me=object: me.x(t))


It is also possible now to specify arg=object for completeness:


sim.AnimateText(text="Hello", x=lambda t: t*10, y=lambda arg, t: arg.x(t), arg=object)


- If a user had forgotten to initialize the environment (with `env = sim.Environment()`), a rather cryptic AttributeError was raised, From now on a meaningful ValueError will be raised instead:

`ValueError: no default environment. Did yout forget to call sim.Environment()?`

- When slicing a monitor in animate mode, the slice ended at `env.now()` rather than `env.t()`, thus making *running averages* in an animation difficult (or incorrect).

- When slicing a non level monitor in animate mode, an error was raised if there were no entries (yet). Fixed.

24.0.9

- The image parameter of `AnimateImage` can now can also be an image in a zip archive. In order to specify that, use the name of the zipfile, followed by a bar (|) and the name of the file in the zip archive. So, for instance
`AnimateImage("cars.zip|bmw.png")`

- Dynamic attributes for anaimation objects can now b expressed differently.
The advanced section of the Animation chapter in the manual mentions says:

> The various classes have a lot of parameters, like color, line width, font, etc.
>
> These parameters can be given just as a scalar, like:
>
>
> sim.AnimateText(text='Hello world', x=200, y=300, textcolor='red')
>
>
> But each of these parameters may also be a:
>
> - function with zero arguments
> - function with one argument being the time t
> - function with two arguments being ‘arg’ and the time t
> - a method with instance ‘arg’ and the time t
>

Although not properly documented, It was always possible to add keyword arguments provided `arg` and `t` were specified:


for n in range(4):
AnimateText(text=lambda arg, t, n=n: self.message[n], y=n * 30)


From this version on, it also possible to leave out `arg` and `t` in this case:


for n in range(4):
AnimateText(text=lambda n=n: self.message[n], y=n * 30)


If the time parameter is required in this case, `env.t()` can be used.

The `arg` parameter is not used at al in this specification.

> [!TIP]
>
> It is strongly recommended to try and use this new specification as it is more intuitive.

Page 3 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.