display pdf pages with GUI on tkinter - python

I`m using pyPdf to crop pdf pages.
And the only thing i miss, is GUI for this script.
I picked up tkinter module to do the GUI, but i cannot find whether it is possible to display pdf pages with GUI created with tkinter.
Any thoughts ?
Thank you.

Tkinter has no support for displaying pdf.

I once tried doing the same thing, and I managed to do it in wxPython with a widget that does just that. On Qt however, I didn't manage to do such a thing, and I doubt you could with Tkinter too.
The closest I got was converting to images and displaying the images: see this question.
Note: I'm talking about wxPython and Qt, but I guess the same principle applies for Tkinter.

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.

import a tkinter widget in wxpython application as a panel

I created a analog rpm gauge using the canvas widget of Tkinter and I want to import it in a wx GUI application (as a panel, maybe). Is there any way to do it or I must rewrite this widget in wx?
There is no (simple) way to do that - WxWidgets is an abstraction over different toolkits in different systems, and use different mainloop functions, while Tkinter has its own mainloop - that is to start with.
So making that work would at leas require:
that you'd setup different threads able to run both mainloops in
paralell,
finding a way to get Tkinter to render the widget to an
in memory bitmap
create a custom widget in wx which would render
that bitmap to the screen
and map events on it back to Tkinter, if
it is supposed to respond events
So you are definitely better of writting the widget again.
WxPython has a speed meter widget just use that instead.
import wx.lib.agw.speedmeter
You would have to rewrite the widget in wxPython or find a widget that does the same thing that's already included with wx. Tkinter is a completely different GUI toolkit that draws its own widgets and is based on TCL whereas wxPython is a wrapper around wxWidgets which is based on C++. There is no easy way to embed a widget from Tkinter into wxPython.
As Yoriz mentioned, you might be able to use the speedmeter widget in wxPython. Check out the wxPython demo package as it will show you how to use that widget and most of wxPython's other widgets. Hopefully you can find something that's already included. Otherwise, you may want to take a look at the following page:
http://wiki.wxpython.org/CreatingCustomControls

Video player creation in 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.

tkinter: Is it possible to attach GUIs from different tkinter programs together and easily navigate across them?

I'd like to build a number of tkinter GUI apps and then stack them together either horizontally or vertically. I'd also like to navigate across the app easily once they become attached so that at any time I can focus on them.
One idea in my mind is that I can have a webpage like frame container, with a scrollbar, then drag other app's GUIs into it so that I can scroll across them.
To attach the windows, I understand that maybe I can get individual app's window through process info, but I just want to make sure if there is a built-in or better way of doing the things I want.
Seeing as you didn't capitalize tkinter, I'm going to assume that you are working in Python 3. If this is so, there are two options that I can think of: Using tkinter frames/grid geometry manager to place each widget side by side, and using tkinter.ttk Notebook to have multiple application tabs. you could also mess around with creating a scrollable tkinter Frame if you were dead set on the scrolling part, but from other Stackoverflow pages it appears that there is no native way to do that.
Example of tkinter.ttk Notebook

Putting a text entry as a pygtk menu item

I am trying to extend a unity appindicator for project hamster. What I want to do is have a text entry directly in the indicator menu. I have seen this for example in the ubuntu memenu, but I cannot figure out how to get it to work with pygtk. I have searched for a while and found nothing. Does anyone know how to do this?
I'm pretty sure there is no way to add that in a menu in PyGTK, but you might try a borderless window popup.

Categories

Resources