# Python command for setting number of keyframes

**URL:** https://discourse.paraview.org/t/python-command-for-setting-number-of-keyframes/13955
**Category:** ParaView Support
**Tags:** python
**Created:** [February 16, 2024, 5:13pm UTC](https://discourse.paraview.org/t/python-command-for-setting-number-of-keyframes/13955 "2024-02-16T17:13:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dpugmire](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dpugmire/32/10169_2.png) [@dpugmire](https://discourse.paraview.org/u/dpugmire)
#### Post date: [February 16, 2024, 5:13pm UTC](https://discourse.paraview.org/t/python-command-for-setting-number-of-keyframes/13955/1 "2024-02-16T17:13:35Z")

</div>

I’m trying to script setting the number of keyframes. I’m using Record State to show me the command. However, when I change the number of keyframes, I don’t see an associated command in the recorded state. Anyone know the command offhand?

Thanks,  
D

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [February 16, 2024, 10:12pm UTC](https://discourse.paraview.org/t/python-command-for-setting-number-of-keyframes/13955/2 "2024-02-16T22:12:40Z")

</div>

Hi Dave,

Could you give a little more detail on what you are doing? I’m assuming you are talking about camera keyframes, but I could be wrong. In Python, `CameraKeyFrame()` creates a keyframe object. You create any number of these then set them on the camera animation track with

```python
camTrack = GetCameraTrack(view=GetActiveView())
camTrack.KeyFrames = [keyframe1, keyframe2, keyframe3,...]

```

If I’ve missed the mark, a bulleted list of what you are doing in the GUI would be me zero in on your request.

Thanks!  
Cory
