JadedTuna
JadedTuna

Reputation: 1833

wxPython htmlWindow <textarea> not working correctly

I am writing a simple program using wx.html.htmlWindow, and I have a problem: when I try to render <textarea></textarea>, it is not being shown! Am I doing something wrong?

Code:

import wx
import wx.html

class MyHtmlFrame(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1)
        self.html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            self.html.SetStandardFonts()
        self.html.SetPage("""<html>
<head>
<title>Test</title>
</head>

<body>
<h1>Header</h1>

<textarea></textarea>
</body>
</html>""")
        self.Show()

app = wx.App(False)
HTML = MyHtmlFrame(None)
app.MainLoop()

N.B.: When I tried <textarea> with wx.html2.WebView, it worked with no problems.

Upvotes: 1

Views: 464

Answers (1)

Fr&#233;d&#233;ric Hamidi
Fr&#233;d&#233;ric Hamidi

Reputation: 263147

<textarea> elements should either reside in a <form> element or expose a form attribute (in HTML5). See Can You Use <textarea> Outside the Scope of a <form>.

Since your <textarea> element does not reside in a <form>, I strongly suspect the HTML renderer ignores it.

Try:

<body>
<h1>Header</h1>

<form>
<textarea></textarea>
</form>
</body>

Upvotes: 1

Related Questions