Hello everyone.......

i need to display the html and php page on the tkinter window...is that possible to create a frame or canvas, which work as a php html interpreter.......... to fetch html i can use urllib module, i think...

Thanks ....

Recommended Answers

All 2 Replies

Not sure about Tkinter, but the PyQT or PySide GUI toolkit can do HTML code for you ...

PySide's QLabel widget can display html formatted text
(PySide is the license free version of PyQT)

tested with PySide474 and Python32

from PySide.QtCore import *
from PySide.QtGui import *

class MyForm(QWidget):
    def __init__(self, html_code):
        # setGeometry(x_pos, y_pos, width, height)
        # 1, 1 --> widget will expand to fit lable size
        self.setGeometry(100, 150, 1, 1)
        self.setWindowTitle("html formatted text")

        # the HTML code is interpreted by the label
        label = QLabel(html_code)

        # use the grid layout manager
        grid = QGridLayout()
        # addWidget(widget, row, column, rowSpan=1, columnSpan=1)
        grid.addWidget(label, 0, 0)

# <H3> and </H3> tags set text size
html_code = """\
you can do scientific text like this ...
x<sup>3</sup> + y<sup>2</sup> - 15 = 0

# create the application
app =  QApplication([])
form = MyForm(html_code)
# run the application

thanks vegasheat....my application GUI is completely based on Tkinter, so its tough to change it on PyQT or any other....

the html and php code i will try to fetch from the urllib module..i need it to display on my application...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.