How to fast forward a PIXI spine animation to last frame? - pixi.js

I am facing problem while playing last frame of pixi spine animation directly.
The animation works fine but i want to skip all frames and run last frame only.

For me the solution was:
trackEntry.trackTime = trackEntry.trackEnd;
Hope it helps.

Found this more usefull:
trackEntry.trackTime = trackEntry.animation.duration

Related

Only display marker at TimeStamp using Folium TimestampedGeoJson

I am plotting ground tracks of a satellite using Folium's TimestampGeoJson plugin. I am able to plot the animated markers, but would like to only display the marker at timestamp. I want the previous markers to disappear, and only have one marker shown on the map at a time, to create the illusion of the satellite moving around the map.
Here is the code I use to generate the map:
import folium
import webbrowser
from folium.plugins import TimestampedGeoJson
def generate_map(latlon_list, geojson_data):
my_map = folium.Map(location=[0,0], height=1000, width=1000, zoom_start=2,
min_zoom=2, max_zoom=12, max_bounds=True, no_wrap=True)
map_name = "folium_1000_1000_map.html"
tgj = TimestampedGeoJson(geojson_data, period="PT1M", add_last_point=False)
my_map.add_child(tgj)
This generates the following:
I want the animation to only display one marker at a time. Here is a ref to a similar question I have found, but none of the answers mentioned there have the effect I want.
Thanks.
And the answer lies in the referenced question, i just added:
tgj = TimestampedGeoJson(satellite["geojson_data"], period="PT1M", duration="PT1M", add_last_point=False)
To my TimestampedGeoJson object, and voila ! Only markers at timestamp will be displayed now. The important option here is the duration one.

Turtle is not running

import turtle
t = turtle.Turtle()
t.right(100)
t.done()
That is my code, but there is no result after run. Why this problem is arising and what can I do now?
t.right(100)
this rotates the turtle by 100 degrees
t.done()
is not a function. All your code is doing essentially is creating a canvas and putting nothing on it. From here, you would need to know about t.pendown() and other functions to make it work this link will be helpful in getting started with the python turtle.

Tkinter and some kind of issue when trying to display images

First off, I'm very new to Python and coding in general. I'm using Python, Tkinter, and Idle version 3.7.3. I'm using an HP Chromebook, with Chrome OS Version 81.0.4044.141.
from tkinter import *
window = Tk()
window.title('Image Example')
img = PhotoImage(file = 'python.gif')
label = Label(window, image = img)
label.pack()
window.mainloop()
As you can see above, this is the small snippet of code that I'm having issues with. As far as I understand, everything is written correctly and the file "python.gif" is in the correct directory. For reference this is what the image should look like:
python.gif (normal)
But when I run the program, this is what I get:
python.gif (screenshot of running program)
That's the result 99% of the time, but I should mention that there have been a RARE number of occasions where the image displayed correctly upon program execution. However, I do not know how to replicate that. Also for more context, I've tried other images to see what happened. I found a free .pgm image to try as an example, and upon execution either I got the same result, or half of the image would appear correctly while the bottom half (also sometimes this would be reversed and the top half would be affected) would be "blacked out".
In conclusion, I wanted to ask if anybody has an idea of what's going on. I'm not sure if this is a hardware issue (because I can view all mentioned images in a normal image viewing app with no problems), or if this has something to do with Python/Tkinter.
Any assistance is very appreciated! Please and Thank You!

Photutils DAOPhot Not Fitting stars well?

I recently ran across the PhotUtils package and am trying to use it to perform PSF Photometry on some images I have. However, when I try to run the code, I get very strange results. When I plot the image generated by get_residual_image(), the stars are not removed well. Some sample images are shown below.
The first image has sigma set to 2.05, as it is in one of the sample programs in the PhotUtils documentation:
However, the stars only appear to be removed in their center.
The second image has sigma set to 5.0. This one is especially strange. Some stars are way over-removed, some are under removed, some black squares are added to the image, etc.
Here is my code:
import photutils
from photutils.psf import DAOPhotPSFPhotometry as DAOP
from photutils.psf import IntegratedGaussianPRF as PRF
from photutils.background import MMMBackground
bkg = MMMBackground()
background = 2.5*bkg(img)
gaussian_prf = PRF(sigma=5.0)
gaussian_prf.sigma.fixed = False
photTester = DAOP(8,background,5,gaussian_prf,31)
photResults = photTester(imgStars)
finalImg = photTester.get_residual_image()
After this, I simply plot the original and final image in MatPlotLib. I use a greyscale colormap. The reason that the left images appear slightly darker is that they use a different color scaling.
Perhaps I have set one of the parameters incorrectly?
Could someone help me out with this? Thank you!
Looking at the residual image instantly told me that the background subtraction might be wrong. I could reproduce the result and wondered, if MMMBackground did not do the job correctly.
After taking a closer look at the documentation, Getting startet with Photutils finally gave the essential hint:
image -= np.median(image)

using layouts in qwidget

I am using qt 4.7 on RHEL 6.0. I am finding very difficut use te layouts. Here is my code.
I have two widgets that are arranged using grid layout.
QWidget *topWidget = new QWidget();
QWidget *bottomwidget = new QWidget();
These two widgets are contained in a QFrame. So now i wanted to add a QPhonon::VideoPlayer widget exactly in b/w the above two widget. For adding am doing like this..
VideoPlayer *vPlayer = new VideoPlayer(Phonon::VideoCategory,this);
vPlayer->setSizePolicy(QSizeHint::Expanding, QSizeHint::Expanding);
QVBoxLayOut *layOut = (QVBoxLayOut*)ui->frame->layout();
layout->insertWidget(1,vPlayer,5,Qt::AlignCenter);
the size of all topWidget, boottomWidget are 768 and 576 which is the size of the D1 video frame. I am playing a video in vPlayer phonon widget. But what I am seeing is vPlayer size is very small and video size also small. Means to say I am not seeing the 768/576 size video. Can somebody help me? Any help would be appreciated.
1)
QVBoxLayOut *layOut = (QVBoxLayOut*)ui->frame->layout();
Do not use C-style casts! Use
dynamic_casr<QVBoxLayout*>(ui->frame->layout())
2)Try to vPlayer->setMinimumSize(QSize(500, 500))
3)And as far as I know Qt, if you want to change GUI or construct complicated ones, then it is preferred to construct GUI's by itself, not with QtDesigner.

Resources