반응형
반응형

PyQt5의 웹 엔진 모듈인 QtWebEngineWidgets를 사용하여 특정 URL을 임베디드 창(아이프레임 형태)으로 보여주고, 새로고침 기능을 포함한 프로그램을 제작

카카오맵과 같은 복잡한 웹 페이지를 렌더링하기 위해서는 단순한 GUI 구성 외에 WebEngine 설정이 필요

PyQt5에서 웹 브라우저 기능을 사용하려면 기본 패키지 외에 PyQtWebEngine을 추가로 설치

pip install PyQt5 PyQtWebEngine

 

 

import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, 
                             QPushButton, QHBoxLayout)
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl

class MapViewer(QWidget):
    def __init__(self):
        super().__init__()
        self.target_url = "https://place.map.kakao.com/SES0331"
        self.initUI()

    def initUI(self):
        # 1. 전체 레이아웃 (수직)
        layout = QVBoxLayout()

        # 2. 컨트롤 레이아웃 (상단 가로)
        control_layout = QHBoxLayout()
        
        # 새로고침 버튼 생성
        self.btn_refresh = QPushButton('🔄 페이지 새로고침')
        self.btn_refresh.setFixedHeight(40) # 버튼 높이 조절
        self.btn_refresh.setStyleSheet("""
            QPushButton {
                background-color: #fee500; /* 카카오 테마색 */
                border-radius: 5px;
                font-weight: bold;
            }
            QPushButton:hover {
                background-color: #fada00;
            }
        """)
        self.btn_refresh.clicked.connect(self.reload_page)
        
        control_layout.addWidget(self.btn_refresh)

        # 3. 웹 엔진 뷰 (아이프레임 역할)
        self.web_view = QWebEngineView()
        self.web_view.setUrl(QUrl(self.target_url))

        # 4. 레이아웃에 위젯 추가
        layout.addLayout(control_layout)
        layout.addWidget(self.web_view)

        self.setLayout(layout)
        self.setWindowTitle('Kakao Map Place Viewer')
        self.setGeometry(100, 100, 1000, 800) # 기본 창 크기 설정
        self.show()

    def reload_page(self):
        """페이지를 다시 불러옵니다."""
        self.web_view.reload()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    
    # 웹 엔진 초기화 (일부 환경에서 필요)
    ex = MapViewer()
    sys.exit(app.exec_())
반응형
반응형

유트브영상 DIV 밑에 위치하기, wmode=opaque

Overlay a HTML element above an embedded youtube iframe

 

<iframe width="560" height="315" src="https://www.youtube.com/embed/CbyFnHZMqfQ?wmode=opaque&showinfo=0&autohide=1&loop=1" frameborder="0" allowfullscreen></iframe>

 

 

유튜브 영상 파라미터 : https://developers.google.com/youtube/player_parameters?hl=ko#autohide

반응형
반응형

IE 10 에서 iframe이 안보이면.

IE 브라우저에서 [도구] - [인터넷옵션] - [보안] tab 

 -  [사용자 지정수준]

 - [설정]

 - "IFRAME에서 프로그램 및 파일 실행" 을 "사용(안전하지않음)" 또는 "확인(권장)"으로 선택해야한다.

 

 

 

How to enable IFRAME in Internet Explorer 10?

Q: When i try to open site with “open here” i receive error:

“You are using iframe redirect incompatible browser and have dev WordPress version installed on this website. If the dashboard doesn’t show, try here.”.

In order to enable iframe in Internet Explorer 10 it’s required to change some security options.

Navigate to Internet Options and Enable “Launching programs and files in IFRAME (not secure).

iframe

Note: After enabling this option Internet Explorer will warn you about security issue because of the way how IE10 sees IFRAME in general.

After enabling this option IFRAME will still not open directly and it’s required to press “Show all content” button in IE10 pop-up.

You can leave this pop-up to show every time or you can disable it by following these steps:

a) Open Internet Explorer from the Desktop

b) Click on tools, and select Internet options

c) In Internet options window, click on security Tab

d) Select Internet Zone and Click on custom level

e) In security settings-Internet Zone window, select miscellaneous

f) Under miscellaneous, Enable the option which states”Display mixed content”

g) Click on ok and Apply

 

 

 

반응형

+ Recent posts