Ejemplo n.º 1
0
 def speech_to_text(self,master):
         speech_to_text_api = IAMAuthenticator('paste here') #paste your speech to text api key
         speech_to_text = SpeechToTextV1(authenticator=speech_to_text_api)
         speech_to_text.set_service_url('paste here') #paste your speech to text service url
         audio = askopenfilename(filetypes=[("mp3 file","*.mp3")])
         try:
                 with open(audio,"rb") as audio_file:
                         speech_to_text_results = speech_to_text.recognize(audio=audio_file,content_type='audio/mp3').get_result()
                 result_s_2_t='''<html><head></head><body><table style="width:100%" border="1"><tr><th><h3 style="color:red;font-family:Comic Sans MS">Classification</h3></th><th><h3 style="color:red;font-family:Comic Sans MS">Confident\nScore<h3></th></tr>'''
                 for result in speech_to_text_results["results"]:
                         for classification in result:
                                 if classification != "final":
                                         result_s_2_t=result_s_2_t+f'<tr><td><center><h3 style="color:blue;font-family:Comic Sans MS">{result[classification][0]["transcript"]}</h3> </center></td><td><center><h3 style="color:blue;font-family:Comic Sans MS"> {str(round(result[classification][0]["confidence"]*100))}%</h3> </center></td></tr>'
                 result_s_2_t=result_s_2_t+f'</table></body></html>'
                 result_loc = ttk.Label(master,text= "Result")
                 clear_loc_btm=Button(master,text="Clear result",bg="black",fg="white")
                 result_loc["font"] = font.Font(family='Comic Sans MS', size=15, weight='bold',underline = True )
                 frame_loc = HtmlFrame(master,horizontal_scrollbar="auto",vertical_scrollbar="auto")
                 frame_loc.set_content(result_s_2_t)
                 clear_loc_btm["command"] = lambda one=result_loc, two=clear_loc_btm, three=frame_loc: self.clear(one,two,three)
                 clear_loc_btm["font"] = font.Font(family='Comic Sans MS', size=10,weight='bold')
                 clear_loc_btm.pack()
                 result_loc.pack()
                 frame_loc.pack(fill="x")
         except:
                 pass
Ejemplo n.º 2
0
 def online_image_classify(self,tab1,url):
         try:
                 vr_api = IAMAuthenticator("paste here") #paste visual recognition your API Key
                 vr1=vr(version="2018-03-19",authenticator=vr_api)
                 vr1.set_service_url("paste here") #paste your visual recognition your service URL
                 if url.get().split(".")[-1] == "gif" or url.get().split(".")[-1] == "jpg" or url.get().split(".")[-1] == "png" or url.get().split(".")[-1] == "tif" or url.get().split(".")[-1] == "jpeg":
                         ibm_result=vr1.classify(url=url.get()).get_result()
                         result = ttk.Label(tab1,text= "Result")
                         clear_btm=Button(tab1,text="Clear result",bg="black",fg="white")
                         result["font"] = font.Font(family='Comic Sans MS', size=15, weight='bold',underline = True )
                         result1='''<html><head></head><body><table style="width:100%" border="1"><tr><th><h2 style="color:red;font-family:Comic Sans MS">Classification</h2></th><th><h2 style="color:red;font-family:Comic Sans MS">Confident Score<h2></th></tr>'''
                         for i in range(len(ibm_result["images"][0]["classifiers"][0]["classes"])):
                                 result1=result1+f'<tr><td><center><h3 style="color:blue;font-family:Comic Sans MS">{ibm_result["images"][0]["classifiers"][0]["classes"][i]["class"]}</h3> </center></td><td><center><h3 style="color:blue;font-family:Comic Sans MS"> {str(round(ibm_result["images"][0]["classifiers"][0]["classes"][i]["score"]*100))}%</h3> </center></td></tr>'
                         result1=result1+f'</table></body></html>'
                         frame = HtmlFrame(tab1,horizontal_scrollbar="auto",vertical_scrollbar="auto")
                         frame.set_content(result1)
                         clear_btm["command"] = lambda one=result, two=clear_btm, three=frame: self.clear(one,two,three)
                         clear_btm["font"] = font.Font(family='Comic Sans MS', size=10,weight='bold')
                         clear_btm.pack()
                         result.pack()
                         frame.pack()
                 else:
                         raise NameError()
         except:
                 messagebox.showwarning(title="URL Error", message=f'''Please enter the proper image URL to classify.\nThe given URl is not a image URL.\nThe given URL is {url.get()}\n The proper image url will end with .gif/.jpg/.png/.tif.''')
Ejemplo n.º 3
0
def displayhtml():

    global fram1
    frame = HtmlFrame(fram1, horizontal_scrollbar="true")
    frame.grid(sticky=NSEW)
    file_read = open("dialog.html", "r")
    frame.set_content(file_read.read())
Ejemplo n.º 4
0
    def insert_html_map(self):
        # https://stackoverflow.com/questions/46571448/tkinter-and-a-html-file
        frame = HtmlFrame(self.master, horizontal_scrollbar="auto")

        frame.set_content("<html>aadaaf </html>")
        #frame.set_content(urllib.request.urlopen("http://thonny.cs.ut.ee").read().decode())
        print("enter insert_html_map: ")
Ejemplo n.º 5
0
    def clickAboutButton(self):
        with open("resources/LICENSE.md") as license:
            about = tk.Toplevel(self.master)
            about.title("About")

            content = HtmlFrame(about)
            content.set_content(md.markdown(license.read()))
            content.grid()
Ejemplo n.º 6
0
class MainWindow(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.setupUI()

    def setupUI(self):
        self.master.title("Markwhat")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)
        self.rowconfigure(1, weight=1)

        self.markwhat_label = Label(self, text="Markwhat")
        self.markwhat_label.grid(sticky=W, row=0, column=0)

        self.markwhat_textarea = WhatText(self, background='white')
        self.markwhat_textarea.grid(row=1, column=0, sticky=NSEW)
        self.markwhat_textarea.beenModified = self.on_markwhat_modfified

        self.markup_label = Label(self, text="Markup")
        self.markup_label.grid(sticky=W, row=0, column=1)

        self.markup_preview = HtmlFrame(self)
        self.markup_preview.grid(row=1, column=1, sticky=NSEW)

        self.preview_button_text = StringVar()
        self.preview_button = Button(
            self,
            textvariable=self.preview_button_text,
            command=self.on_preview_click,
        )
        self.preview_button_text.set('HTML')
        self.preview_button.grid(row=2, column=1, sticky=W)

    def on_markwhat_modfified(self, event):
        text = self.markwhat_textarea.get('1.0', END)
        markup_text = parse_markdown(text)

        if isinstance(self.markup_preview, HtmlFrame):
            self.markup_preview.set_content(markup_text)
        else:
            self.markup_preview.delete('1.0', END)
            self.markup_preview.insert('1.0', markup_text)

    def on_preview_click(self):
        if isinstance(self.markup_preview, HtmlFrame):
            self.markup_preview = WhatText(self, background="white")
            self.preview_button_text.set('HTML')
        else:
            self.markup_preview = HtmlFrame(self)
            self.preview_button_text.set('HTML Source')

        self.markup_preview.grid(row=1, column=1, sticky=NSEW)
        self.on_markwhat_modfified(None)
Ejemplo n.º 7
0
    def __init__(self, master):
        top = self.top = Toplevel(master)
        html_label = HtmlFrame(top,
                               horizontal_scrollbar="auto",
                               vertical_scrollbar=True)
        html_label.pack(fill="both", expand=True)
        html_label.set_content(main.html)

        self.b = Button(top, text='Esci', command=self.cleanup)
        self.b.pack()
Ejemplo n.º 8
0
 def popupmsg(self, monster_name, html):
     popup = Tk()
     popup.wm_title(monster_name)
     html_label = HtmlFrame(popup,
                            horizontal_scrollbar="auto",
                            vertical_scrollbar=True)
     html_label.pack(fill="both", expand=True)
     html_label.set_content(html)
     B1 = ttk.Button(popup, text="Close", command=popup.destroy)
     B1.pack()
     popup.mainloop()
def displayresult():
    frame = HtmlFrame(gtuapp,
                      horizontal_scrollbar="auto",
                      vertical_scrollbar="auto",
                      width=500,
                      height=500)
    frame.set_content(r.content)
    frame.pack(expand='yes', fill='both')

    global MyButton2
    MyButton2 = Button(frame, text="Back", width=10, command=frame.destroy)
    MyButton2.place(x=0, y=0)
Ejemplo n.º 10
0
def open_about_window():
    """Opens About window, which displays README.md."""
    about_window = Toplevel(root)

    about_window.title("About")

    dir_path = os.path.dirname(os.path.realpath(__file__))

    with open(os.path.join(dir_path, 'README.md')) as readme:
        text = readme.read()
    html_readme = markdown.markdown(text)
    frm_readme = HtmlFrame(about_window, horizontal_scrollbar="auto")
    frm_readme.grid(sticky=tk.NSEW)
    frm_readme.set_content(html_readme)
Ejemplo n.º 11
0
def open_contact_window():
    """Opens Contact window, which displays contact info."""
    contact_window = Toplevel(root)
    contact_window.title("Contact")

    text = '''
           Please direct your comments and suggestions to this email:
           [email protected]

           You can also open issues or create pull requests in this github repository:
           github.com/ceferisbarov/ANL-book-retriever/
           '''
    html_contact = markdown.markdown(text)
    frm_contact = HtmlFrame(contact_window, horizontal_scrollbar="auto")
    frm_contact.grid(sticky=tk.NSEW)
    frm_contact.set_content(html_contact)
Ejemplo n.º 12
0
    def view_stocks_click(self):
        self.LOG.debug('Clicked on view stocks')
        try:
            html = self.portfolio.df_stocks(to_email=True)

            top = self.create_top_level(title='Stocks In Portfolio',
                                        geometry='685x255')

            hf = HtmlFrame(top)
            hf.pack()
            hf.set_content(html)

        except AttributeError:
            messagebox.showinfo('System Message',
                                'No stocks to show',
                                icon='error')
            self.LOG.exception('No stocks to show in view stocks')
            raise
Ejemplo n.º 13
0
    def stats_click(self):
        self.LOG.debug('Clicked on show stats')
        try:
            html = Application.portfolio.df_history(tabulate_mode=True)

            top = self.create_top_level(title='Portfolio History Stats',
                                        geometry='620x400')

            hf = HtmlFrame(top)
            hf.pack()
            hf.set_content(html)

        except AttributeError:
            messagebox.showinfo('System Message',
                                'No history stats to show',
                                icon='error')
            self.LOG.exception('No history to show in stats')
            raise
Ejemplo n.º 14
0
class HelpWindow():
    def __init__(self):
        self.root = Tk()
        self.root.geometry("500x300")
        self.root.title("MORtty Terminal - Info")
        self.root.configure(background="white")
        self.WebPage = HtmlFrame(self.root)
        self.WebPage.set_content('''<p align=center>hgihk</p>''')
        self.WebPage.place(relx=0.0, rely=0.0, relheight=0.9, relwidth=1.0)

        self.ButtonFrame = Frame(self.root)
        self.ButtonFrame.place(relx=0.0, rely=0.9, relheight=0.1, relwidth=1.0)

        self.Closebutton = Button(self.ButtonFrame)
        self.Closebutton.configure(text='Close', command=self.root.destroy)
        self.Closebutton.place(relx=0.5, rely=0.5, anchor='center')

    def mainloop(self):
        self.root.mainloop()
Ejemplo n.º 15
0
 def local_image_classify(self,tab2):
         img_file = askopenfilename(filetypes=[("Image files",("*.png","*.jpeg","*.jpg"))])                   
         vr_api = IAMAuthenticator("paste here") #paste your visual recognition API Key
         vr1=vr(version="2018-03-19",authenticator=vr_api)
         vr1.set_service_url("paste here") #paste your visual recognition your service URL
         try:
                 with open(img_file,"rb") as img:
                         loc_img_result=vr1.classify(images_file=img).get_result()
                 result_loc = ttk.Label(tab2,text= "Result")
                 clear_loc_btm=Button(tab2,text="Clear result",bg="black",fg="white")
                 result_loc["font"] = font.Font(family='Comic Sans MS', size=15, weight='bold',underline = True )
                 result_loc1='''<html><head></head><body><table style="width:100%" border="1"><tr><th><h2 style="color:red;font-family:Comic Sans MS">Classification</h2></th><th><h2 style="color:red;font-family:Comic Sans MS">Confident Score<h2></th></tr>'''
                 for i in range(len(loc_img_result["images"][0]["classifiers"][0]["classes"])):
                         result_loc1=result_loc1+f'<tr><td><center><h3 style="color:blue;font-family:Comic Sans MS">{loc_img_result["images"][0]["classifiers"][0]["classes"][i]["class"]}</h3> </center></td><td><center><h3 style="color:blue;font-family:Comic Sans MS"> {str(round(loc_img_result["images"][0]["classifiers"][0]["classes"][i]["score"]*100))}%</h3> </center></td></tr>'
                 result_loc1=result_loc1+f'</table></body></html>'
                 frame_loc = HtmlFrame(tab2,horizontal_scrollbar="auto",vertical_scrollbar="auto")
                 frame_loc.set_content(result_loc1)
                 clear_loc_btm["command"] = lambda one=result_loc, two=clear_loc_btm, three=frame_loc: self.clear(one,two,three)
                 clear_loc_btm["font"] = font.Font(family='Comic Sans MS', size=10,weight='bold')
                 clear_loc_btm.pack()
                 result_loc.pack()
                 frame_loc.pack()
         except:
                 pass
Ejemplo n.º 16
0
class EmailRenderingScreen(
        ttk.Frame
):  # implementarea frame-ului pentru randarea mail-urilor html si text
    def __init__(self, parent: MainWindow):
        super().__init__(parent)
        self.__parent = parent
        self.__email_renderer = HtmlFrame(self)
        self.__text_display = Text(self)
        self.back_button = ttk.Button(self)
        self.respond_button = ttk.Button(self)
        self.redirect_button = ttk.Button(self)
        self.header = ttk.Label(self)

        self.__setup__email_rendering_screen()

    def __setup__email_rendering_screen(self):
        self.configure(borderwidth=3, relief="sunken")

        self.back_button.configure(text="Back")
        self.respond_button.configure(text="Respond")
        self.redirect_button.configure(text="Redirect")

        self.back_button.grid(row=2, column=0, sticky=W)
        self.redirect_button.grid(row=2, column=2, sticky=E)
        self.respond_button.grid(row=2, column=1, sticky=E)
        self.header.grid(row=0, column=0, columnspan=3, sticky=(N, S, E, W))

        self.rowconfigure(1, weight=1)
        self.columnconfigure(1, weight=1)

    @staticmethod
    def process_content(content: str):
        bs = BeautifulSoup(content, features="lxml")
        for tag in bs.find_all("style"):
            content = content.replace(str(tag), "")

        return content.split("--- mail_boundary ---")[-1]

    def set_content(self, content: str, subtype: str = "plain"):
        if subtype == "plain":
            self.__text_display.configure(state="normal")
            self.__text_display.delete(1.0, "end")
            self.__text_display.insert(1.0, content)
            self.__text_display.configure(state="disabled")
            self.__text_display.grid(row=1,
                                     column=0,
                                     columnspan=3,
                                     sticky=(N, S, E, W))
        else:
            content = self.process_content(content)
            self.__email_renderer.set_content(content)
            self.__email_renderer.grid(row=1,
                                       column=0,
                                       columnspan=3,
                                       sticky=(N, S, E, W))
            self.__parent.geometry("800x300")

    def grid_rmv(self):
        self.__text_display.grid_remove()
        self.__email_renderer.grid_remove()
        self.grid_remove()

    def set_header(self, header: MIMEText):
        from_address = header["From"]
        to_address = header["To"]
        subject = header["Subject"]
        date = header["Date"]
        self.header[
            "text"] = f"From: {from_address}\nTo: {to_address}\nSubject: {subject}\nDate: {date}"

    def show(self):
        self.grid(column=0, row=0, sticky=(N, S, E, W))

    def clear_all(self):
        self.__text_display.delete(1.0, "end")
        self.header["text"] = ""
#import urllib.request
try:
    import tkinter as tk
except ImportError:
    import Tkinter as tk

from tkinterhtml import HtmlFrame

root = tk.Tk()

frame = HtmlFrame(root, horizontal_scrollbar="auto")

frame.set_content("<html></html>")

#frame.set_content(urllib.request.urlopen("http://thonny.cs.ut.ee").read().decode())
#print(frame.html.cget("zoom"))

root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
root.mainloop()
Ejemplo n.º 18
0
from tkinter import *
from unidecode import unidecode
from tkinterhtml import HtmlFrame

from myfeedparser import MyFeedParser

window = Tk()
window.geometry("800x600")
window.title("Welcome to My Feed Parser")

frame = HtmlFrame(window,
                  horizontal_scrollbar="auto",
                  vertical_scrollbar="auto")
f = MyFeedParser()
s = f.getLatestFeedsAsHtml(True)

# Convert non-ascii characters to their best ascii representation
#print(s)
ascii = unidecode(s)

frame.set_content(ascii)

frame.pack(expand=True, fill="both")
#window.pack_propagate()

window.mainloop()
Ejemplo n.º 19
0
            try:
                h = submission.title.lower().find('[h]')
                w = submission.title.lower().find('[w]')
                if w > h:
                    want = submission.title.lower().split('[w]')[1]
                else:
                    want = submission.title.lower().split('[h]')[0]
            except:
                continue

            if 'paypal' in want.lower():  # aka if it's a selling post

                html = f'<html><body>{markdown2.markdown(submission.selftext)}</body></html>'
                frame = HtmlFrame(root, horizontal_scrollbar="auto")
                frame.grid(sticky=tk.NSEW)
                frame.set_content(html)
                root.columnconfigure(0, weight=1)
                root.rowconfigure(0, weight=1)
                root.update_idletasks()
                root.update()

                # CREATE INSTANCE OF CLASS HWSPOST, GIVE IT ATTRIBUTES OF TITLE, BODY, URL.
                try:
                    post_title = submission.title.split('[H]')[1].split(
                        '[W]')[0]
                    post_body = submission.selftext.replace(
                        ',', '')  # Remove ',' in price tags
                    post_url = submission.url.strip()
                    post_author = submission.author

                    post = HWSPost(title=post_title,
Ejemplo n.º 20
0
frame.set_content("""
<html>

<head>
<meta name=标题 content="">
<meta name=关键词 content="">
<meta http-equiv=Content-Type content="text/html; charset=x-mac-chinesesimp">
<meta name=Generator content="Microsoft Word 14 (filtered)">
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Times New Roman";}
 /* Page Definitions */
@page WordSection1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
-->
</style>

</head>

<body lang=ZH-CN style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:宋体'>(格式编号<span
lang=EN-US>202025</span>-<span lang=EN-US>R1</span>-<span lang=EN-US>2008</span>)</span></p>

<p class=MsoNormal align=center style='text-align:center'><span
style='font-family:宋体'>北</span> <span style='font-family:宋体'>京</span> <span
style='font-family:宋体;letter-spacing:-.8pt'>电<span lang=EN-US>&nbsp; </span>力<span
lang=EN-US>&nbsp; </span></span><span style='font-family:宋体'>设</span> <span
style='font-family:宋体'>计</span> <span style='font-family:宋体'>院</span></p>

<p class=MsoNormal align=center style='text-align:center'><b><span
style='font-size:18.0pt;font-family:宋体'>质</span></b><b><span style='font-size:
18.0pt'> </span></b><b><span style='font-size:18.0pt;font-family:宋体'>量</span></b><b><span
style='font-size:18.0pt'> </span></b><b><span style='font-size:18.0pt;
font-family:宋体'>信</span></b><b><span style='font-size:18.0pt'> </span></b><b><span
style='font-size:18.0pt;font-family:宋体'>息</span></b><b><span style='font-size:
18.0pt'> </span></b><b><span style='font-size:18.0pt;font-family:宋体'>反</span></b><b><span
style='font-size:18.0pt'> </span></b><b><span style='font-size:18.0pt;
font-family:宋体'>馈</span></b><b><span style='font-size:18.0pt'> </span></b><b><span
style='font-size:18.0pt;font-family:宋体'>单</span></b></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style='font-family:宋体'>编</span>
<span style='font-family:宋体'>号:</span><span lang=EN-US>10</span><span
style='font-family:宋体'>-</span><span lang=EN-US>2011</span><span
style='font-family:宋体'>-</span><span lang=EN-US>01</span></p>

<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=486
 style='margin-left:-34.6pt;border-collapse:collapse;border:none'>
 <tr style='height:22.0pt'>
  <td width=99 valign=top style='width:99.0pt;border-top:1.5pt;border-left:
  1.5pt;border-bottom:1.0pt;border-right:1.0pt;border-color:black;border-style:
  solid;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>信息名称</span></p>
  </td>
  <td width=165 valign=top style='width:165.0pt;border-top:solid black 1.5pt;
  border-left:none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>变电站主变增容工程应充分考虑施工临时过渡过程</span></p>
  </td>
  <td width=78 valign=top style='width:78.0pt;border-top:solid black 1.5pt;
  border-left:none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>填卡人员</span></p>
  </td>
  <td width=144 valign=top style='width:144.0pt;border-top:solid black 1.5pt;
  border-left:none;border-bottom:solid black 1.0pt;border-right:solid black 1.5pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>李雪男</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=99 valign=top style='width:99.0pt;border-top:none;border-left:solid black 1.5pt;
  border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;padding:0cm 1.4pt 0cm 1.4pt;
  height:22.0pt'>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>信息来源</span></p>
  </td>
  <td width=165 valign=top style='width:165.0pt;border-top:none;border-left:
  none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>回龙观<span lang=EN-US>220kV</span>站主变增容改造工程</span></p>
  </td>
  <td width=78 valign=top style='width:78.0pt;border-top:none;border-left:none;
  border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;padding:0cm 1.4pt 0cm 1.4pt;
  height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>填卡日期</span></p>
  </td>
  <td width=144 valign=top style='width:144.0pt;border-top:none;border-left:
  none;border-bottom:solid black 1.0pt;border-right:solid black 1.5pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  lang=EN-US>2011-2-28</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=486 colspan=4 valign=top style='width:486.0pt;border-top:none;
  border-left:solid black 1.5pt;border-bottom:solid black 1.0pt;border-right:
  solid black 1.5pt;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  style='font-family:宋体'>信息内容:</span></p>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  style='font-family:宋体'>在回龙观</span><span lang=EN-US>220kV</span><span
  style='font-family:宋体'>站主变增容改造工程中,由于回龙观站主变重载,在</span><span lang=EN-US>2011</span><span
  style='font-family:宋体'>年度夏前要将</span><span lang=EN-US>2</span><span
  style='font-family:宋体'>台</span><span lang=EN-US>180MVA</span><span
  style='font-family:宋体'>的主变增容至</span><span lang=EN-US>2</span><span
  style='font-family:宋体'>台</span><span lang=EN-US>250MVA</span><span
  style='font-family:宋体'>主变。</span></p>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  style='font-family:宋体'>由于工程的特殊性,及与设总、相关部门沟通不足:昌平区经济发展较快,其负荷增长水平高于北京市平均水平,且回龙观站现状处于满载状态,在施工过渡期间有</span><span
  lang=EN-US>1</span><span style='font-family:宋体'>台</span><span lang=EN-US>180MVA</span><span
  style='font-family:宋体'>的主变将带全站负荷,如果不考虑负荷的转移将导致施工期间单台主变过载运行,在可研审核会中会议没有明确要增加施工过渡期间的负荷分析及临时切改方案,会后设计人没有与设总、相关部门在这个问题上进行沟通,导致可研报告缺少施工过渡期间负荷分析及临时切改方案论述的内容。</span></p>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  lang=EN-US>&nbsp;</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=486 colspan=4 valign=top style='width:486.0pt;border-top:none;
  border-left:solid black 1.5pt;border-bottom:solid black 1.0pt;border-right:
  solid black 1.5pt;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;
  </span><span style='font-family:宋体'>信息分析及处理意见:</span></p>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>出现以上问题的原因主要是:做工程之前要对工程的特殊性有充分的了解,审核会中要把有疑问的地方要求在会议上明确,要做到主动与设总、相关部门及时沟通。</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
  style='font-family:宋体'>室主任:</span> <span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2011
  </span><span style='font-family:宋体'>年</span><span lang=EN-US>&nbsp; 2</span><span
  style='font-family:宋体'>月</span> <span lang=EN-US>28 </span><span
  style='font-family:宋体'>日</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=486 colspan=4 valign=top style='width:486.0pt;border:solid black 1.5pt;
  border-top:none;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;
  </span><span style='font-family:宋体'>处理结果:</span></p>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>回龙观</span><span lang=EN-US>220kV</span><span
  style='font-family:宋体'>站主变增容改造工程中增加过渡方案的说明。</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
  <p class=MsoNormal style='text-indent:105.0pt;line-height:20.0pt'><span
  lang=EN-US>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
  style='font-family:宋体'>责任部门主管:</span><span lang=EN-US>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
  style='font-family:宋体'>年</span><span lang=EN-US>&nbsp;&nbsp;&nbsp; &nbsp;</span><span
  style='font-family:宋体'>月</span> &nbsp;<span lang=EN-US>&nbsp;&nbsp;</span><span
  style='font-family:宋体'>日</span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

</div>

</body>

</html>

""")
Ejemplo n.º 21
0
class Application(Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()

        # Global vars
        self.messages = []

        # Create Widgets
        self.btn_connect = Button(self, text="Connect", command=self.connect)
        self.chat_messages = HtmlFrame(self, horizontal_scrollbar="auto")
        self.message_entry_value = StringVar()
        self.message_entry = Entry(self, textvariable=self.message_entry_value)
        self.btn_send_msg = Button(self, text="Send", command=self.send_msg)
        self.label_status = Label(self, text="Disconnected")

        # Pack widgets
        self.pack_widgets()

    def pack_widgets(self):
        self.btn_connect.pack(side="top")
        self.chat_messages.pack(side="bottom")
        self.message_entry_value.set("")
        self.message_entry.pack(side="bottom")
        self.btn_send_msg.pack(side="bottom")
        self.label_status.pack(side="bottom")

    def connect(self):
        self.label_status['text'] = "Connecting..."

        try:
            # Connect to the gateway
            sio = socketio.Client()
            sio.connect('http://localhost:5000', namespaces=['/chat'])
            self.label_status['text'] = "Connected. SID : " + sio.sid

            # Event listeners
            register(LocalEvents.EVENT_MESSAGE_ADDED, lambda event: self.on_message_added(event.data))

            # Register namespaces
            sio.register_namespace(ChatSocketHandler('/chat'))
        except Exception as e:
            self.label_status['text'] = e

    def send_msg(self):
        dispatch(Event(LocalEvents.EVENT_MESSAGE_SEND, self.message_entry_value.get()))
        self.message_entry_value.set("")

    def on_message_added(self, data):
        self.messages.append(data)

        chat_messages = ""

        for message in self.messages:
            chat_messages = markdown.markdown(
                "**" + message['user_id'] + "**: " + message['message'] + '\n'
            ) + chat_messages

        self.chat_messages.set_content("""
            <html>
                <body style="font-size: 20px;">
                    {0}
                </body>
            </html>    
        """.format(chat_messages))
Ejemplo n.º 22
0
    import Tkinter as tk

from tkinterhtml import HtmlFrame

root = tk.Tk()

frame = HtmlFrame(root, horizontal_scrollbar="auto")
frame.grid(sticky=tk.NSEW)

frame.set_content("""
<html>
<body>
<h1>Hello world!</h1>
<p>First para</p>
<ul>
    <li>first list item</li>
    <li>second list item</li>
</ul>
<img src="http://findicons.com/files/icons/638/magic_people/128/magic_ball.png"/>
</body>
</html>    
""")

frame.set_content(
    urllib.request.urlopen("http://thonny.cs.ut.ee").read().decode())
#print(frame.html.cget("zoom"))

root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
root.mainloop()
Ejemplo n.º 23
0
frame.set_content("""
<html>

<head>
<meta name=标题 content="">
<meta name=关键词 content="">
<meta http-equiv=Content-Type content="text/html; charset=x-mac-chinesesimp">
<meta name=Generator content="Microsoft Word 14 (filtered)">
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Times New Roman";}
 /* Page Definitions */
@page WordSection1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
-->
</style>

</head>

<body lang=ZH-CN style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:宋体'>(格式编号<span
lang=EN-US>202025</span>-<span lang=EN-US>R1</span>-<span lang=EN-US>2008</span>)</span></p>

<p class=MsoNormal align=center style='text-align:center'><span
style='font-family:宋体'>北</span> <span style='font-family:宋体'>京</span> <span
style='font-family:宋体;letter-spacing:-.8pt'>电<span lang=EN-US>&nbsp; </span>力<span
lang=EN-US>&nbsp; </span></span><span style='font-family:宋体'>设</span> <span
style='font-family:宋体'>计</span> <span style='font-family:宋体'>院</span></p>

<p class=MsoNormal align=center style='text-align:center'><b><span
style='font-size:18.0pt;font-family:宋体'>质</span></b><b><span style='font-size:
18.0pt'> </span></b><b><span style='font-size:18.0pt;font-family:宋体'>量</span></b><b><span
style='font-size:18.0pt'> </span></b><b><span style='font-size:18.0pt;
font-family:宋体'>信</span></b><b><span style='font-size:18.0pt'> </span></b><b><span
style='font-size:18.0pt;font-family:宋体'>息</span></b><b><span style='font-size:
18.0pt'> </span></b><b><span style='font-size:18.0pt;font-family:宋体'>反</span></b><b><span
style='font-size:18.0pt'> </span></b><b><span style='font-size:18.0pt;
font-family:宋体'>馈</span></b><b><span style='font-size:18.0pt'> </span></b><b><span
style='font-size:18.0pt;font-family:宋体'>单</span></b></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style='font-family:宋体'>编</span>
<span style='font-family:宋体'>号:</span><span lang=EN-US>10</span><span
style='font-family:宋体'>-</span><span lang=EN-US>2011</span><span
style='font-family:宋体'>-</span><span lang=EN-US>01</span></p>

<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=486
 style='margin-left:-34.6pt;border-collapse:collapse;border:none'>
 <tr style='height:22.0pt'>
  <td width=99 valign=top style='width:99.0pt;border-top:1.5pt;border-left:
  1.5pt;border-bottom:1.0pt;border-right:1.0pt;border-color:black;border-style:
  solid;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>信息名称</span></p>
  </td>
  <td width=165 valign=top style='width:165.0pt;border-top:solid black 1.5pt;
  border-left:none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>变电站主变增容工程应充分考虑施工临时过渡过程</span></p>
  </td>
  <td width=78 valign=top style='width:78.0pt;border-top:solid black 1.5pt;
  border-left:none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>填卡人员</span></p>
  </td>
  <td width=144 valign=top style='width:144.0pt;border-top:solid black 1.5pt;
  border-left:none;border-bottom:solid black 1.0pt;border-right:solid black 1.5pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>李雪男</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=99 valign=top style='width:99.0pt;border-top:none;border-left:solid black 1.5pt;
  border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;padding:0cm 1.4pt 0cm 1.4pt;
  height:22.0pt'>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>信息来源</span></p>
  </td>
  <td width=165 valign=top style='width:165.0pt;border-top:none;border-left:
  none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>回龙观<span lang=EN-US>220kV</span>站主变增容改造工程</span></p>
  </td>
  <td width=78 valign=top style='width:78.0pt;border-top:none;border-left:none;
  border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;padding:0cm 1.4pt 0cm 1.4pt;
  height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  style='font-family:宋体'>填卡日期</span></p>
  </td>
  <td width=144 valign=top style='width:144.0pt;border-top:none;border-left:
  none;border-bottom:solid black 1.0pt;border-right:solid black 1.5pt;
  padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  lang=EN-US>2011-2-28</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=486 colspan=4 valign=top style='width:486.0pt;border-top:none;
  border-left:solid black 1.5pt;border-bottom:solid black 1.0pt;border-right:
  solid black 1.5pt;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  style='font-family:宋体'>信息内容:</span></p>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  style='font-family:宋体'>在回龙观</span><span lang=EN-US>220kV</span><span
  style='font-family:宋体'>站主变增容改造工程中,由于回龙观站主变重载,在</span><span lang=EN-US>2011</span><span
  style='font-family:宋体'>年度夏前要将</span><span lang=EN-US>2</span><span
  style='font-family:宋体'>台</span><span lang=EN-US>180MVA</span><span
  style='font-family:宋体'>的主变增容至</span><span lang=EN-US>2</span><span
  style='font-family:宋体'>台</span><span lang=EN-US>250MVA</span><span
  style='font-family:宋体'>主变。</span></p>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  style='font-family:宋体'>由于工程的特殊性,及与设总、相关部门沟通不足:昌平区经济发展较快,其负荷增长水平高于北京市平均水平,且回龙观站现状处于满载状态,在施工过渡期间有</span><span
  lang=EN-US>1</span><span style='font-family:宋体'>台</span><span lang=EN-US>180MVA</span><span
  style='font-family:宋体'>的主变将带全站负荷,如果不考虑负荷的转移将导致施工期间单台主变过载运行,在可研审核会中会议没有明确要增加施工过渡期间的负荷分析及临时切改方案,会后设计人没有与设总、相关部门在这个问题上进行沟通,导致可研报告缺少施工过渡期间负荷分析及临时切改方案论述的内容。</span></p>
  <p class=MsoNormal style='text-indent:21.75pt;line-height:20.0pt'><span
  lang=EN-US>&nbsp;</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=486 colspan=4 valign=top style='width:486.0pt;border-top:none;
  border-left:solid black 1.5pt;border-bottom:solid black 1.0pt;border-right:
  solid black 1.5pt;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;
  </span><span style='font-family:宋体'>信息分析及处理意见:</span></p>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>出现以上问题的原因主要是:做工程之前要对工程的特殊性有充分的了解,审核会中要把有疑问的地方要求在会议上明确,要做到主动与设总、相关部门及时沟通。</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
  style='font-family:宋体'>室主任:</span> <span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2011
  </span><span style='font-family:宋体'>年</span><span lang=EN-US>&nbsp; 2</span><span
  style='font-family:宋体'>月</span> <span lang=EN-US>28 </span><span
  style='font-family:宋体'>日</span></p>
  </td>
 </tr>
 <tr style='height:22.0pt'>
  <td width=486 colspan=4 valign=top style='width:486.0pt;border:solid black 1.5pt;
  border-top:none;padding:0cm 1.4pt 0cm 1.4pt;height:22.0pt'>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;
  </span><span style='font-family:宋体'>处理结果:</span></p>
  <p class=MsoNormal align=center style='text-align:center;line-height:20.0pt'><span
  lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='text-indent:21.0pt;line-height:20.0pt'><span
  style='font-family:宋体'>回龙观</span><span lang=EN-US>220kV</span><span
  style='font-family:宋体'>站主变增容改造工程中增加过渡方案的说明。</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;</span></p>
  <p class=MsoNormal style='line-height:20.0pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
  <p class=MsoNormal style='text-indent:105.0pt;line-height:20.0pt'><span
  lang=EN-US>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
  style='font-family:宋体'>责任部门主管:</span><span lang=EN-US>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
  style='font-family:宋体'>年</span><span lang=EN-US>&nbsp;&nbsp;&nbsp; &nbsp;</span><span
  style='font-family:宋体'>月</span> &nbsp;<span lang=EN-US>&nbsp;&nbsp;</span><span
  style='font-family:宋体'>日</span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

</div>

</body>

</html>

""")
Ejemplo n.º 24
0
except ImportError:
    import Tkinter as tk

from tkinterhtml import HtmlFrame

root = tk.Tk()

frame = HtmlFrame(root, horizontal_scrollbar="auto")
frame.grid(sticky=tk.NSEW)

root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)

frame.set_content("""
<html>
<body>
<h1>Hello world!</h1>
<p>First para</p>
<ul>
    <li>first list item</li>
    <li>second list item</li>
</ul>
</body>
</html>    
""")

frame.set_content(
    urllib.request.urlopen("http://tkhtml.tcl.tk/").read().decode())

root.mainloop()
Ejemplo n.º 25
0
                command=find_update,
                fg="blue",
                bg="#90B3DD",
                activeforeground="red",
                activebackground="#90B3DD",
                cursor="hand2",
                relief=FLAT,
                underline=0)
link_5.place(x=20, y=420)
link_5.config(highlightthickness=0)

frame2 = HtmlFrame(master=tab3, width=640,
                   horizontal_scrollbar="auto")  # Tab3_Frame2
frame2.pack(fill=tk.BOTH, side=tk.LEFT, expand=True)

frame2.set_content(open("assets/help.html", "r").read())

# ----------------------------Fast Youtube Search ----------------

cust_font = font = ('Consolas', 16)
width = 800
height = 500
img1 = Image.open("assets/ytsearchbg.png")
img1 = img1.resize((width, height), Image.ANTIALIAS)
photoImg1 = ImageTk.PhotoImage(img1)
wb1 = Label(tab5, image=photoImg1)
wb1.pack()

Name_Label = Label(tab5,
                   font=cust_font,
                   text="Fast Search in Youtube",
Ejemplo n.º 26
0
class RssEnterprise():
    def __init__(self):
        self.root = tk.Tk()
        self.root.geometry("1000x700")
        self.root.title('RSS Enterprise')
        # self.root.iconbitmap("/home/stef/Python/rss_enterprise/icon.ico")

        self.settings_folder_path = os.path.join(Path.home(),
                                                 '.rss_enterprise')

        self.assert_settings()

        with open(self.get_cache_path(), mode='a') as self.fp_cache:
            top_frame = Frame(self.root)
            top_frame.pack(fill=BOTH, expand=True)

            bottom_frame = Frame(self.root)
            bottom_frame.pack(fill=BOTH, expand=True)

            self.tree = ttk.Treeview(top_frame,
                                     selectmode='browse',
                                     columns=(
                                         'title',
                                         'feed',
                                         'published',
                                     ))
            self.refresh_list()

            scrollbar_tree = ttk.Scrollbar(top_frame,
                                           orient="vertical",
                                           command=self.tree.yview)
            self.tree.configure(yscrollcommand=scrollbar_tree.set)
            self.tree.bind("<<TreeviewSelect>>", self.on_tree_select)
            self.tree.bind('<Return>', self.open_current_weblink)
            self.tree.heading('#0', text='title', anchor=tk.CENTER)
            self.tree.heading('#1', text='feed', anchor=tk.CENTER)
            self.tree.heading('#2', text='published', anchor=tk.CENTER)

            self.tree.column('#0', stretch=tk.YES, minwidth=50, width=630)
            self.tree.column('#1', stretch=tk.YES, minwidth=50, width=150)
            self.tree.column('#2', stretch=tk.YES, minwidth=50, width=200)

            scrollbar_tree.pack(side='right', fill='y')
            self.tree.pack(fill=BOTH, expand=True)

            self.text = HtmlFrame(self.root,
                                  fontscale=1.2,
                                  horizontal_scrollbar="auto")
            self.text.pack(fill=BOTH, expand=True)

            self.root.mainloop()

    def assert_settings(self):
        if not os.path.isdir(self.settings_folder_path):
            os.mkdir(self.settings_folder_path)

        if not os.path.isfile(self.get_feeds_path()):
            copyfile(os.path.join('test', 'feeds.txt'), self.get_feeds_path())

        if not os.path.isfile(self.get_cache_path()):
            with open(self.get_cache_path(), mode="w") as fp:
                fp.write('')

    def open_current_weblink(self, event):
        id = self.tree.selection()[0]
        self.open_link(id)

    def get_feeds_path(self):
        return os.path.join(self.settings_folder_path, 'feeds.txt')

    def get_cache_path(self):
        return os.path.join(self.settings_folder_path, 'cache')

    def load_feeds(self, feeds_path):
        print('loading feeds')
        with open(feeds_path, 'r') as fp:
            feeds = [
                l.strip() for l in fp.read().splitlines() if l.strip() != ''
            ]
            return feeds

    def add_line_to_cache(self, line):
        self.fp_cache.write(line + '\n')

    def load_feed(self, feeds, feed_url):
        print('start loading ', feed_url)
        result = feedparser.parse(feed_url)
        if result['status'] == 404:
            print(feed_url, 'was not found')
        else:
            feeds.append(result)

    def load_news_items(self, feed_urls):
        print('loading news items')

        feeds = []

        threads = [
            Thread(target=self.load_feed, args=(feeds, feed_url))
            for feed_url in feed_urls
        ]

        [t.start() for t in threads]
        [t.join() for t in threads]

        entries = []

        for feed in feeds:
            for i in feed["items"]:
                i['channel_title'] = feed['channel']['title']
                try:
                    i['formatted_date'] = parse(i['published'])
                    print(i['published'])
                except KeyError:
                    i['formatted_date'] = parse(i['updated'])
                    print(i['updated'])

                if i['formatted_date'].tzinfo is None or i[
                        'formatted_date'].tzinfo.utcoffset(
                            i['formatted_date']) is None:
                    i['formatted_date'] = i['formatted_date'].replace(
                        tzinfo=pytz.utc)

            entries.extend(feed["items"])

        sorted_entries = sorted(entries, key=lambda entry: i['formatted_date'])
        sorted_entries.reverse()

        return sorted_entries

    def refresh_list(self):
        with open(self.get_cache_path(), 'r') as fp:
            cache = fp.read().splitlines()

        feeds = self.load_feeds(self.get_feeds_path())
        all_news_items = self.load_news_items(feeds)
        for i in all_news_items:
            try:
                if i['link'] not in cache:
                    self.tree.insert('',
                                     'end',
                                     i['link'],
                                     text=i['title'],
                                     values=(
                                         i['channel_title'],
                                         i['formatted_date'],
                                         i['summary'],
                                     ))
            except (TclError, KeyError):
                # in case of double entries, or entries without a link, we just forget about them
                pass

    def on_tree_select(self, event):
        id = self.tree.selection()[0]
        summary = self.tree.item(id, "values")[2]
        self.set_input(summary)
        self.add_line_to_cache(id)

    def open_link(self, link):
        # works only on linux
        subprocess.Popen(['xdg-open', link])
        sleep(0.5)
        subprocess.Popen([
            'wmctrl',
            '-a',
            'RSS Enterprise',
        ])

    def set_input(self, value):
        self.text.set_content(value)
Ejemplo n.º 27
0
 def text_to_speech(self,master):
         try:
                 def convert():
                         api_text_2_speech = IAMAuthenticator("paste here") #paste your text to speech api key
                         text_2_speech = TextToSpeechV1(authenticator=api_text_2_speech)
                         text_2_speech.set_service_url("paste here") #paste your text to speech service url
                         if var.get() == "male voice":
                                 try:
                                         audio_result = asksaveasfilename(defaultextension=".mp3",filetypes=[("mp3 file","*.mp3")])
                                         with open(audio_result,"wb") as audio:
                                                 audio.write(text_2_speech.synthesize(text,accept="audio/mp3",voice="en-US_HenryV3Voice").get_result().content)
                                                 audio.close()
                                         messagebox.showinfo("Done","Your text file is successfully converted into audio file. Your audio file saved in male voice at " + audio_result)
                                 except:
                                         pass
                         elif var.get() == "female voice":
                                 try:
                                         audio_result = asksaveasfilename(defaultextension=".mp3",filetypes=[("mp3 file","*.MP3")])
                                         with open(audio_result,"wb") as audio:
                                                 audio.write(text_2_speech.synthesize(text,accept="audio/mp3",voice="en-US_AllisonVoice").get_result().content)
                                                 audio.close()
                                         messagebox.showinfo("Done","Your text file is successfully converted into audio file. Your audio file is saved in female voice at " + audio_result)
                                 except:
                                         pass
                         
                         else:
                                 messagebox.showwarning(title="Voice Error", message=f'''Please select the voice and save again.''')
                         
                 def sel():
                         selection = "Your audio will be saved in " + str(var.get())
                         label.config(text = selection)
                 text_file = askopenfilename(filetypes=[("text file","*.txt")])
                 with open(text_file) as text_data:
                         text = text_data.read()
                 text_html = f'''<html><head></head><body><p>{text}</p></body><html>'''
                 result_loc = ttk.Label(master,text= "The Text")
                 clear_loc_btm=Button(master,text="Clear",bg="black",fg="white")
                 result_loc["font"] = font.Font(family='Comic Sans MS', size=15, weight='bold',underline = True )
                 frame_loc = HtmlFrame(master,horizontal_scrollbar="auto",vertical_scrollbar="auto")
                 frame_loc.set_content(text_html)
                 clear_loc_btm["font"] = font.Font(family='Comic Sans MS', size=12,weight='bold')
                 var = StringVar()
                 R1 = Radiobutton(master, text="Save as male voice", variable=var, value="male voice",command=sel)
                 R1["font"] = font.Font(family='Comic Sans MS', size=11)
                 R1.pack()
                 R2 = Radiobutton(master, text="Save as female voice", variable=var, value="female voice",command=sel)
                 R2["font"] = font.Font(family='Comic Sans MS', size=11)
                 R2.pack() 
                 label = ttk.Label(master)
                 label["font"] = font.Font(family='Comic Sans MS', size=11)
                 label.pack()
                 save_audio = Button(master,text="Save",bg="blue",fg="white",command=convert)
                 save_audio["font"] = font.Font(family='Comic Sans MS', size=11, weight='bold')
                 save_audio.pack()
                 em = ttk.Label(master)
                 em.pack()
                 clear_loc_btm["command"] = lambda one=result_loc, two=clear_loc_btm, three=frame_loc, four=R1, five=R2, six=label, seven = save_audio,egith = em: self.clear(one,two,three,four,five,six,seven,egith)
                 clear_loc_btm.pack()
                 result_loc.pack()
                 frame_loc.pack(fill="x")
         except:
                 pass
Ejemplo n.º 28
0
for file in glob.glob("*.db"):
    conn = sqlite3.connect(file)
    cur = conn.cursor()
    cur.execute(
        "SELECT date, payload, sender FROM history_message ORDER BY date DESC")
    rows = cur.fetchall()
    conn.close()

    with open('archive.html', 'wb') as html:
        for row in rows:
            time_string = time.strftime("%a, %d %b %Y %H:%M:%S",
                                        time.localtime(int(row[0] / 1000000)))
            message = row[1].replace('<div>', '').replace('</div>', '')
            sender = time_formatting + ' ' + row[2] + ' </span>'
            full_line = '<div>' + time_formatting + time_string + ': </span> ' + sender + ' - ' + message + '</div>' + '\n '
            html.write(full_line.encode('UTF-16'))

frame = HtmlFrame(root, horizontal_scrollbar="auto")
frame.grid(sticky=tk.NSEW)

# url = r'C:\Users\u8008701\Desktop\test\test.html'
url = profile + path + '\\' + 'archive.html'
print(url)
frame.set_content(
    urllib.request.urlopen(r'file:///' + url).read().decode('utf-16'))
# print(frame.html.cget("zoom"))

root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
root.mainloop()