Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6032437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:20:02+00:00 2026-05-23T05:20:02+00:00

does anyone know how i would go about using a tkinter window as an

  • 0

does anyone know how i would go about using a tkinter window as an output from a videosink/pipeline from within python? i have found methods for lots of other GUI systems, but i dont want to have to use tkinter and something else together xxx
thanks in advance x

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:20:03+00:00Added an answer on May 23, 2026 at 5:20 am

    This works for me on Windows 32-bit. I get a seg fault on Linux or Windows 64-bit. Sorry, I don’t know about Mac.

    You have to use bus.connect(“sync-message::element”, on_sync_message) and pass a Tk widget ID (winfo_id), as you can see in the following code. The container can be any Tk widget, but a solid black frame seems to work best for me.

    import sys, os
    from Tkinter import *
    import pygst
    pygst.require("0.10")
    import gst
    
    
    def start():
            player.set_property('video-sink', None)
            player.set_property("uri", "file:///" + sys.argv[1])
            player.set_state(gst.STATE_PLAYING)
    
    def on_sync_message(bus, message):
            if message.structure is None:
                    return
            message_name = message.structure.get_name()
            if message_name == "prepare-xwindow-id":
                    imagesink = message.src
                    imagesink.set_property("force-aspect-ratio", True)
                    imagesink.set_xwindow_id(mwin_id)
    
    window = Tk()
    window.geometry("500x400")
    movie_window = Frame(window,bg='#000000')
    movie_window.pack(side=BOTTOM,anchor=S,expand=YES,fill=BOTH)
    
    mwin_id = movie_window.winfo_id()
    
    player = gst.element_factory_make("playbin2", "player")
    fakesink = gst.element_factory_make('fakesink', 'novideo')
    player.set_property('video-sink', fakesink)
    
    bus = player.get_bus()
    bus.add_signal_watch()
    bus.enable_sync_message_emission()
    bus.connect("sync-message::element", on_sync_message)
    
    start()
    window.mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From what limited info we have about EF 4.0, does anyone know if we
Does anyone know how I would go about changing (transforming) an image based on
Does anyone know why a library initialized within dlopen() would initialize a static variable
I thought I would ask about this here. Does anyone know of any work
Does anyone know any good tutorial about using NAnt for native code build process
Does anyone know about Facebook checkins with the Facebook iOS SDK? I have made
Does anyone know how I would go about detected what bit version Windows is
I'm about to code some graphs and charts from scratch. Does anyone know of
Does anyone know what would be the minimum rights I would need to grant
Does anyone know of a library that would allow me to manipulate Flex DOM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.