So I was wondering if an electric planer would do a better job at making those edges straight?
Yes. In addition to being far far faster it is much more likely to result in straighter edges. It's possible a planer could straighten the edge pictured in just one or two passes, the work of perhaps 5 seconds.
Unfortunately details of how you'd do this work accurately and safely1 can't be provided because there are too many variables2 but yes in theory you can do this with one.
A hand plane would make this task much safer, and while it would take a little longer you could still be looking at under a minute. However, in addition to having to buy a plane as you clarified in the Comments if you don't already own suitable sharpening equipment you'd need to buy that too. And on top of learning how to use the plane itself you'd have to learn to sharpen well enough to produce a very good edge (something that many struggle with for a long time) in order for the plane to work properly. So while I'd favour this approach myself it's probably not the ideal recommendation for you, unless you already wanted to get into hand planing.
There is an elephant in the room though....
Wrong saw for this type of cut
I understand if the scroll saw is the only saw you have available you have to use it, but it's not well suited to this type of cutting. Scroll saws are made to do intricate, mostly curved cuts and struggle to do straight cuts of any length. Although various tricks can be used to help improve the results3 I'd still recommend looking at some options.
The simplest, cheapest and easiest is a hand saw of some kind. There are numerous decent options available that should cost around the €10 mark, and occasionally less4, with a range of tooth styles — Western, Japanese and a few modern hybrids.
With a sharp saw of any style a cut like this can leave a very good, flat surface that may require no further work depending on what you're doing. Nearly perfect dead-straight crosscuts and mitre cuts are possible with a fine-toothed saw used carefully, especially if the cut is done with the help of an aid such as a mitre block/mitre box, or a magnetic sawing guide which would be clamped to the workpiece.
1 Planers have spinning cutterheads that you want to be very careful not go get fingers near unless a guard can be improvised.
2 Much depends on the specific design details of the planer which are unknown. And then there are two basic approaches, moving the wood past the tool or moving the planer past the wood (similar to shooting done with a hand plane, often done with the wood held in a jig called a shooting board).
3 Simply clamping a straight piece of wood to the bed of the saw to act as a fence and running the wood along it would help a great deal.
4 E.g. from Lidl or Aldi.