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

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 …
Jump to Post

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):
        QWidget.__init__(self)
        # 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)
        self.setLayout(grid)

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

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

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.