how to create a pop up massage in python? - python

firstly what do you call this popup and how do you create it in python?
I don't know what do you call it, that's why I couldn't create it.

You can use the tkinter library in python.
Please see this solution How to create a modal dialog in tkinter?

This can be done with the win10toast module in python, more information can be found here on the PyPi website https://pypi.org/project/win10toast/
Note: This will not create exactly what is referenced in the picture above, but instead it creates a notification at the bottom right of a windows 10 machine.

Related

Embedding Chrome browser in python QT GUI?

I have a python GUI that opens a Chrome window using Seleium. Is there any way in the PyQT GUI to embed the Chrome browser's window so there are not 2 separate windows and its just the GUI? Guessing not possible but worth it to ask.
I have been looking to do exactly the same. I don't have a complete answer but hopefully some of what I found will be of use to others who are trying to do this as well.
It IS possible to embed the window of an outside application into a Python QT application. While I could quote various reference pages I have found that the following question gives most of the information and a good starting point to find more:
QT 5.5 embed external application into QWidget
Now, that requires knowing the Window ID but that isn't too hard to find. You can do that in Windows at least as described here:
http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-subprocess.html
As I said, this isn't a complete answer but should put anyone else following this trail several steps closer to the complete answer. Good luck everyone and if you find the complete answer please share it.

How to create a file browser in wxpython

I am developing the GUI for my application using wxpython and have most of the features down, except in the main frame/window I want to have a box for choosing a file (in this case, the input will have to be an excel file). Something similar to the standard filebrowser that is accessed whenever you choose "open" from a menu.
Below is an image to show exactly what I want...
You probably want a wx.FileDialog. It provides access to the default file dialog of the OS your app is running in. You can see an example of how it's used in the wxPython demo package. This tutorial also has some screenshots and sample code:
http://www.blog.pythonlibrary.org/2010/06/26/the-dialogs-of-wxpython-part-1-of-2/
The screenshot you show appears to be an interface to actually open the dialog. You can easily create that using sizers and basic widgets. Then just bind the open button to a handler that will show the dialog.
You might also want to take a look at the FileBrowseButton from wx.lib.filebrowsebutton (also in the demo).
There are a few other related widgets which you might be interested in too: wx.DirDialog, MultiDirDialog or wx.GenericDirDialog.
Assuming you know the basics of wxPython you can use wx.GenericDirCtrl and wx.ListCtrl to make nice browser

How do I open a gif in Python?

I'm wondering if it's possible to play an animated gif using Python. I'd just like to display a set of them and iterate at a certain interval. I'm wondering what the best route to take to open them in python. Is it possible to open with Preview (I'm using a Mac) or perhaps a web browser package?
You can do this using Tkinter library in python. You can even add buttons, labels etc..
More Information:
https://docs.python.org/2/library/tkinter.html#a-simple-hello-world-program
http://effbot.org/tkinterbook/photoimage.htm

Using Tkinter to open a webpage

So my App needs to be able to open a single webpage(and it must be from the internet and not saved) in it, and specifically I'd like to use the Tkinter GUI toolkit since it's the one i'm most comfortable with. On top of that though, I'd like to be able to generate events in the window(say a mouse click) but without actually using the mouse. What's a good method to go about this?
EDIT: I suppose to clarify this a bit, I need a way to load a webpage, or maybe even a specific java applet into a tkinter widget or window. Or if not that perhaps another method to do this where I can generate mouse and keyboard events without using either the mouse of the keyboard.
If you want it to be opened inside your GUI use Bryans suggestion, if you just want to open a webpage you can use:
import webbrowser
webbrowser.open("page.html")
Tkinter does not have a widget that can render a web page.
So i found this module named pywebview
pip install pywebview
sample code:-
import webview
webview.create_window('duckduckgo', 'https://www.duckduckgo.com')
webview.start() #this will open the webpage in a new window
You should use pywebview it is very easy only code three lines .
I used it but in my case it didn't work everywhere. Comment and let me know if it works for you.
The best option that works everywhere is PyQt's QtWebview module. You might run into one problem that is to rename the window, so here is the solution
web.setWindowTitle(title)
You can use all the functions as it is but just replace window or self with web like the above code.

Python Desktop Integration - Drag and drop

I have a pygame window that I want to know when a file has been dragged and dropped onto it. I only need to be able to fetch the name of the file. How can this be accomplished?
Here's a forum thread that might be what you're looking for.
And another forum.
And a link to the msdn page. You'll probably want the pythoncom library.
one option for a similar effect is is to use pygame's scrap module so you can copy-paste into the window, your program would just need to look for ctr-V events.
On this XFCE desktop I'm using
If I hit ctrl-C with a file selected, the file name shows up when I type
pygame.scrap.init()
types= pygame.scrap.get_types()
print dict(
[type,pygame.scrap.get(type)]
for type intypes
)

Categories