#coding=utf-8
import sys
import os
from   os.path import abspath, dirname
sys.path.insert(0,abspath(dirname(__file__)))
import tkinter
from   tkinter import *
import pandas as pd
import numpy as np
import Fun
uiName="Project1"
ElementBGArray={}  
ElementBGArray_Resize={} 
ElementBGArray_IM={} 

from tkinterweb import HtmlFrame

# __all__ = ['HtmlFrame', 'HtmlLabel', 'TkinterWeb', 'Notebook', 'Demo']


import tkinter as tk
class HtmlLabelPyMe:

    def __init__(self,Canvas):

        self.Canvas = Canvas

        self.html_frame = HtmlFrame(self.Canvas, horizontal_scrollbar="auto", vertical_scrollbar="auto",messages_enabled=False)

        self.html_frame.pack(fill=tk.BOTH, expand=True)

        self.load_initial_page()



    def load_initial_page(self):

        html_content = """

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>自动播放视频</title>
</head>
<body>
    <!-- 使用<object>标签播放视频并设置自动播放 -->
    <object width="640" height="480" data="file:///D:/SeasunGame/Game/JX3/bin/zhcn_hd/ui/Video/JX3WL.mp4" type="video/mp4" autoplay="true">
        <!-- 备用文本，当浏览器不支持时显示 -->
        您的浏览器不支持视频播放，或者视频文件不存在。
    </object>
</body>
</html>

        """
        self.html_frame.load_html(html_content)



    # 设置HTML内容

    # 设置HTML内容

        # 将传入的HTML内容赋值给实例变量htmlContent

    def load_html(self, htmlContent):

        # 将HTML内容加载到html_frame中

        self.htmlContent = htmlContent

        self.html_frame.load_html(htmlContent)





#Form 'Form_1's Load Event :
def Form_1_onLoad(uiName,threadings=0):
    pass
#Timer 'Timer_1's Timer Event :
def Timer_1_onTimer(uiName,widgetName,count=0):
    value = Fun.GetCurrentValue(uiName,'Progress_1')
    Fun.SetCurrentValue(uiName,'Progress_1',value + 1)
    if value + 1 >= 100 :
        Fun.SetCurrentValue(uiName,'Progress_1',0)
        Timer_1=Fun.GetElement(uiName,'Timer_1')
        Timer_1.Stop()
def Button_1_onCommand(uiName,widgetName,threadings=0):
    Fun.CallUIDialog('newWindowProgress',topmost = 1,toolwindow = 1,grab_set = 1,wait_window = 1,animation='',params=None) 
    #Fun.GoToUIDialog(uiName,'newWindowProgress',params=None)
    
    
    
#Button 'Button_2' 's Command Event :
def Button_2_onCommand(uiName,widgetName,threadings=0):
    Timer_1=Fun.GetElement(uiName,'Timer_1')
    Timer_1.Start()
