Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Tkinter to open a webpage

Tags:

python

tkinter

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.

like image 484
NightW. Avatar asked Jan 14 '23 15:01

NightW.


2 Answers

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")
like image 113
Evilunclebill Avatar answered Jan 27 '23 16:01

Evilunclebill


Tkinter does not have a widget that can render a web page.

like image 43
Bryan Oakley Avatar answered Jan 27 '23 16:01

Bryan Oakley