Video player creation in python - python

I need to create a widget that will play two synchronized (H264) videos, among other things. I have never done any GUI stuff before and would like to accomplish my goal with the least amount of work. I have two questions:
Do Tkinter or Qt have functionality that allows me play videos synchronously?
I have looked at both Tkinter and Qt and it seems there is no easy, built in, way to do so. But, then again, I am pretty unfamiliar with these systems so I could have overlooked something.

I'm not sure on the synchronous video side, but this related post may help understand more about potential limitation regarding video in tkinter
Way to play video files in Tkinter?
Hope this a helpful...gl

Qt lets you play videos using the QVideoWidget and QMediaPlayer. There's an example player for PyQt.
For Tkinter there is no default widget for playing videos. You can play videos with tkinter, but this is not using one of the tkinter widgets and a bit hackish. See this answer on stackoverflow
Synchronizing is tricky with videos, but possible. You would have to set the videos to start at the exact same time, with the same frame rate.

Related

Drag and drop files in Tkinter GUI

I am fairly new to Python and is stuck at a problem. I am using Python 3.7 and intend to add a "drag-and-drop" functionality to my GUI.
I have some files that needs to be read, thus i am looking for an option where i can simply drag those files to a particular area in my GUI and file name or Path is read by my program.
Being a newbie a detailed answer or a code would be highly helpful.
Thanks
Unfortunately, tkinter only supports experimental widget drag and drop, nothing else. I ran into similar problems trying to make a complex GUI.
I would look into wxPython. It's complex, Object Oriented, and daunting, but has and unbelievable amount of features that reward you for learning it. Including file drag and drop.
Look at the wxPython thumbnails at https://wxpython.org/Phoenix/docs/html/gallery.html for images of what the widgets look like. The thumbnails include images for about half of the available widgets. The images are also a bit out of date.
Look at pronounced https://pythonlibrary.org or https://zetcode.com for the best tutorials. After them, your best resource is Google and the forums.

move a stereoscopic video on the screen

I would like to move a (stereoscopic) video on a computer screen automatically. Think of the video as the ball in a Pong game. The problem is that it should be a stereoscopic 3D video. So the video size itself is kind of small. I did this kind of movements with pictures or drawing object, but I don't know how to do it with video material!
Does somebody know how I can do this? I already searched for video tools in python like pygame or pyglet. I have an external player Bino 3d which can open the desired video. But how can I make it move around the screen?
Or is there a tool in other programming languages like c/c++ or Matlab which can help?
By the way, the program will be on a Linux OS.
I'll be grateful for any help or hints!
Anna
I'd try to use a decent video client (mplayer, vlc). They can present the video in lots of ways, hopefully your stereoscopic issue can be solved by them.
Then I would let the client present a single window (not fullscreen) which I then would move around using window manager controls.
If you must not have window decorations around the video or if the output shall be a specific window, I think mplayer at least can be told to use an existing window to perform the output in. Maybe that's an approach then.

Play music from Python

Does anybody know if it's possible to press the play button on a music website using Python? What I'm trying to do is make an alarm clock script that plays a random playlist on a music site.
Here and here are similar questions (I think), although I don't know if what I'm using applies to this. I'm trying to use Grooveshark.
The first linked question's answer, to use Selenium, is probably your best bet. You can write your code in Python, and any other way of interfacing with a website as complex as Grooveshark will probably not be easy. There is an API (http://developers.grooveshark.com) but for what you want Selenium is probably the easiest approach.
just use tkinter button widget and use pygame musicplayer, it works very well.

what framework to use for python card game?

my question is quite simple, but I can't move on until I solve it. I want to develop a card game, something like Magic the Gathering. I suppose there will be just a little of animation, but much work with images, image transformation and special rendering - some kind of things, that every unit has now attack plus 2 so cards on table will adapt.
I thought Python will be best for it, because it easy to develop with it and I know it pretty well. Also I have a little of experience with PyQt and Pygame. But I can't decide which one is better for that purpose. What do you think will be easier to use: PyQt, Pygame or something else?
if you want just a simple animation and want to finish your game fast. use the pyqt's scene view. refer to (Rapid GUI programming using python and pyqt) book if you want to learn more about scene view.
PySolitaire is a collection of more than 300 solitaire and Mahjongg games. So maybe if you browse around, perhaps you can get some idea.
What is better? If you are developing games, PyGame I guess.
Both pygame and pyqt will work for what you want to do, but I'd recommend pyqt: you'll be able to use standard widgets (like listboxes, textboxes, menus, buttons, ...).
I've never worked with pyqt myself, but I image that drag 'n drop is something built-in, which will be really useful for a card game.
With pygame on the other hand you'll have to make everything yourself. This will give it more of a game feel as you can draw everything exactly like you want it to look like, but it'll take more work as you have to implement basic stuff yourself.

Python/Tkinter Audio Player

I'm developing a media player. Right now it's a simple window with a button to load .wav files. The problem is I would like to implement a pause button now. But, when playing a audio file the GUI isn't accessible again (no buttons can be pushed) till the file is done playing. How can I make the GUI dynamic while an audio file is playing?
I'm using PyAudio, and their implementation doesn't allow this.
Probably you have to use threads for that. You have to play your audio file in a different thread than the gui mainloop so that the GUI keeps responding user input.
IMHO, wxpython is not so complicated and has some utility functions that would help to do what you want. Check the wxpython demo, you have several examples there.
You can alternatively use pygame mixer for the purpose , I made the same in pyqt and I did'nt require to implement threading . You can get the documentation of pygame mixer at https://www.pygame.org/docs/ref/mixer.html
Happy Coding .
Try this out:
Check the code https://drive.google.com/file/d/0B7ccI33Aew5fNVhwZ2puYTBuUFU/view?usp=sharing
I have used pygame also.Hope this helps.

Categories

Resources