I put the conditional expression in {2}, {3} and try to put green in case of Ture and red in case of False. Is it possible to use SetForegroundColour to represent colors? If you run it, it will be None. Do you need another method?
I also tried
background-image: url ('1.png');
to specify the background, it's a white background. When using<img scr = 1.png />
inside the body tag, an x display image error appears.
# -*- coding: utf-8 -*-
import wx
import wx.html2
import sqlite3
class AppFrame(wx.Frame):
def __init__(self, parent):
super(AppFrame, self).__init__(parent)
self.html_view = wx.html2.WebView.New(self)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.html_view, 1, wx.EXPAND)
self.SetSizer(sizer)
if __name__ == '__main__':
i = 'test1'
j = 'test2'
k = ('True', 'False')
l = ('True(color Green)', 'False(color Red)', 'How??')
for loop1 in k: pass
if loop1 == 'True': a = print(k[0])
else: a = print(k[1])
app = wx.App()
frame = AppFrame(None)
frame.html_view.SetPage("""
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>HTML TEST</title>
<style>
table{{
width: 100%;
border-collapse: collapse
}}
table, th, td{{
border: 2px solid #bcbcbc;
text-align: center;
}}
body{{
background-image:url('1.png');
background-position: conter conter;
background-color:gold;
}}
</style>
</head>
<body>
<table>
<caption><h1>Hello world!<h1></caption>
<thead>
<tr>
<th>{0}</th>
<th>{1}</th>
<th>Ipsum</th>
<th>Ipsum</th>
<th>Ipsum</th>
<th>Ipsum</th>
</tr>
</thead>
<tbody>
<tr>
<td>{2}</td>
<td>{3}</td>
<td>Dolor</td>
<td>Dolor</td>
<td>Dolor</td>
<td>Dolor</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6">Table Foot</td>
</tr>
</tfoot>
</table>
<script>
if({0} == 'True'){{
???
}}
else{{
???
}}
</script>
</body>
</html>
""".format(i, j, a, l), "")
frame.Show(True)
app.MainLoop()