0

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 ....

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by sun_2588
0

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_()

Edited by vegaseat: n/a

0

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...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.