파이썬 pyqt webengine 아주 간단한 질문 있습니다.

조회수 681회
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import QWebEngineView

class Example(QWidget):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        vbox = QVBoxLayout(self)
        self.webEngineView = QWebEngineView()
        self.loadPage()
        vbox.addWidget(self.webEngineView)
        self.setLayout(vbox)

    def loadPage(self):
        self.html = """
        <!DOCTYPE HTML>
        <html lang="ko">
          <head>
            <meta charset='utf-8'>
            <title>T E S T</title>
            <style type='text/css'>
              html, body{height:100%;}
              html{background-image:url(bg7.png);}
              table{width:100%; height:92%;}                  
              table, caption, th, td{     
                border:2px solid gray;      
                border-collapse:collapse;
                color:#505050;        
                text-align:center;              
                font-size:155%;     
                font-style:normal;      
                font-weight:bold;
                font-family:Malgun Gothic;                    
              }
              caption{{color:#505050; font-size:250%; font-weight:bold;}        
              th{{color:#505050; font-size:145%; font-weight:bold;}   
              td.name{font-size:165%;}
              caption, th{background-image:url(bg1.png);}  
            </style>
          </head>
          <body scroll='no'>
            <table summary='test'>
              <caption>A B C D E F G</caption>
              <thead>
                <tr>      
                  <th style='border-bottom: 7px solid gray'>1</th>
                  <th style='border-bottom: 7px solid gray'>2</th>
                  <th style='border-bottom: 7px solid gray'>3</th>
                  <th style='border-bottom: 7px solid gray'>4</th>
                  <th style='border-bottom: 7px solid gray'>5</th>
                  <th style='border-bottom: 7px solid gray'>6</th>  
                </tr>
              </thead>
              <tbody>
                <tr style='background: lightblue'> 
                  <td>{0}</td>
                  <td class='name'>{1}</td>
                  <td>{2}</td>     
                  <td><p style='color:{3}'>{4}</p></td>
                  <td><p style='color:{5}'>{6}</p></td>
                  <td><p style='color:{7}'>{8}</p></td>      
                </tr>
                <tr style='background-image: url(1.bmp)'>  
                  <td>{9}</td>
                  <td class='name'>{10}</td>
                  <td>{11}</td>     
                  <td><p style='color:{12}'>{13}</p></td>
                  <td><p style='color:{14}'>{15}</p></td>
                  <td><p style='color:{16}'>{17}</p></td>      
              </tbody>
              <tfoot>
                <tr style='background: pink'>
                  <td colspan="6"><marquee><font color='#505050'>{144}</font></marquee></td>
                </tr>
              </tfoot>  
            </table> 
          </body>
        </html>
        """
        self.webEngineView.setHtml(self.html)


def main():
    app = QApplication(sys.argv)
    ex = Example()
    ex.showFullScreen()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

위코드를 실행하면 간단한 테이블 html화면이 나옵니다 테이블 tr 부분만 이미지를 이용해서 배경화면으로 넣으려고하는데 안되네요 모듈문제인지... <tr style='background: lightblue'> 이렇게하면 되고 <tr style='background-image: url(1.bmp)'> 이렇게 하면 안되는 이유를 모르겠습니다??

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)