• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python webview.create_window函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webview.create_window函数的典型用法代码示例。如果您正苦于以下问题:Python create_window函数的具体用法?Python create_window怎么用?Python create_window使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_window函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: serve_forever

 def serve_forever(self):
     try:
         import webview
         Server.start(self)
         webview.create_window(self.title, self.address, **self._application_conf)
         Server.stop(self)
     except ImportError:
         raise ImportError('PyWebView is missing. Please install it by:\n    '
                           'pip install pywebview\n    '
                           'more info at https://github.com/r0x0r/pywebview')
开发者ID:loopbio,项目名称:remi,代码行数:10,代码来源:server.py


示例2: invalid_bg_color

def invalid_bg_color():
    with pytest.raises(ValueError):
        webview.create_window('Background color test', 'https://www.example.org', background_color='#dsg0000FF')

    with pytest.raises(ValueError):
        webview.create_window('Background color test', 'https://www.example.org', background_color='FF00FF')

    with pytest.raises(ValueError):
        webview.create_window('Background color test', 'https://www.example.org', background_color='#ac')

    with pytest.raises(ValueError):
        webview.create_window('Background color test', 'https://www.example.org', background_color='#EFEFEH')

    with pytest.raises(ValueError):
        webview.create_window('Background color test', 'https://www.example.org', background_color='#0000000')
开发者ID:r0x0r,项目名称:pywebview,代码行数:15,代码来源:test_bg_color.py


示例3: create_new_window

def create_new_window():
    # Create new window and store its uid
    child_window = webview.create_window('Window #2', width=800, height=400)

    # Load content into both windows
    webview.load_html('<h1>Master Window</h1>')
    webview.load_html('<h1>Child Window</h1>', uid=child_window)
开发者ID:r0x0r,项目名称:pywebview,代码行数:7,代码来源:multiple_windows.py


示例4: localization

def localization():
    strings = {
        "cocoa.menu.about": u"О программе",
        "cocoa.menu.services": u"Cлужбы",
        "cocoa.menu.view": u"Вид",
        "cocoa.menu.hide": u"Скрыть",
        "cocoa.menu.hideOthers": u"Скрыть остальные",
        "cocoa.menu.showAll": u"Показать все",
        "cocoa.menu.quit": u"Завершить",
        "cocoa.menu.fullscreen": u"Перейти ",
        "windows.fileFilter.allFiles": u"Все файлы",
        "windows.fileFilter.otherFiles": u"Остальлные файльы",
        "linux.openFile": u"Открыть файл",
        "linux.openFiles": u"Открыть файлы",
        "linux.openFolder": u"Открыть папку",
        "linux.saveFile": u"Сохранить файл",
    }

    webview.create_window('Localization test', 'https://www.example.org', strings=strings)
开发者ID:r0x0r,项目名称:pywebview,代码行数:19,代码来源:test_localization.py


示例5: js_bridge

def js_bridge():
    class Api2:
        def test2(self, params):
            return 2

    webview.load_html('<html><body><h1>Master window</h1></body></html>')

    api2 = Api2()
    child_window = webview.create_window('Window #2', js_api=api2)
    assert child_window != 'MainWindow'
    webview.load_html('<html><body><h1>Secondary window</h1></body></html>', uid=child_window)
    assert_js(webview, 'test1', 1)
    assert_js(webview, 'test2', 2, uid=child_window)

    webview.destroy_window(child_window)
开发者ID:r0x0r,项目名称:pywebview,代码行数:15,代码来源:test_multi_window.py


示例6: evaluate_js

def evaluate_js():
    child_window = webview.create_window('Window #2', 'https://google.com')
    assert child_window != 'MainWindow'
    result1 = webview.evaluate_js("""
        document.body.style.backgroundColor = '#212121';
        // comment
        function test() {
            return 2 + 5;
        }
        test();
    """)

    assert result1 == 7

    result2 = webview.evaluate_js("""
        document.body.style.backgroundColor = '#212121';
        // comment
        function test() {
            return 2 + 2;
        }
        test();
    """, uid=child_window)
    assert result2 == 4
    webview.destroy_window(child_window)
开发者ID:r0x0r,项目名称:pywebview,代码行数:24,代码来源:test_multi_window.py


示例7:

import webview

"""
This example demonstrates how to enable debugging of webview content. To open
up debugging console, right click on an element and select Inspect.
"""

if __name__ == '__main__':
    webview.create_window('Debug window', 'https://pywebview.flowrl.com/hello', debug=True)
开发者ID:r0x0r,项目名称:pywebview,代码行数:9,代码来源:debug.py


示例8: serve_forever

 def serve_forever(self):
     import webview
     Server.start(self)
     webview.create_window(self._application_name, self.address, **self._application_conf)
     Server.stop(self)
开发者ID:hallee,项目名称:espresso-arm,代码行数:5,代码来源:server.py


示例9: get_current_url

import webview
import threading

"""
This example demonstrates how to get the current url loaded in the webview.
"""


def get_current_url():
    print(webview.get_current_url())


if __name__ == '__main__':
    t = threading.Thread(target=get_current_url)
    t.start()

    webview.create_window("Get current URL", "https://pywebview.flowrl.com/hello")
开发者ID:r0x0r,项目名称:pywebview,代码行数:17,代码来源:get_current_url.py


示例10: load_html

import webview
import threading

"""
This example demonstrates how to load HTML in a web view window
"""

def load_html():
    webview.load_html("<h1>This is dynamically loaded HTML</h1>")


if __name__ == '__main__':
    t = threading.Thread(target=load_html)
    t.start()

    # Create a non-resizable webview window with 800x600 dimensions
    webview.create_window("Simple browser", width=800, height=600, resizable=True)

开发者ID:wikiped,项目名称:pywebview,代码行数:17,代码来源:load_html.py


示例11: start

 def start(self):
     thread.start_new_thread(self.counter, (2, "https://calendar.google.com?mode=day", 0))
     webview.create_window("wall program", "html/start.html", fullscreen=True)
开发者ID:ironman5366,项目名称:Scrolling-Program,代码行数:3,代码来源:screensmain.py


示例12:

import webview

"""
This example demonstrates how to create a CEF window. Available only on Windows.
"""

if __name__ == '__main__':
    # Create a CEF window
    webview.config.gui = 'cef'
    webview.create_window('CEF browser', 'https://pywebview.flowrl.com/hello')
开发者ID:r0x0r,项目名称:pywebview,代码行数:10,代码来源:cef.py


示例13:

import webview

"""
This example demonstrates a webview window with a quit confirmation dialog
"""

if __name__ == '__main__':
    # Create a standard webview window
    webview.create_window("Simple browser", "http://www.flowrl.com", confirm_quit=True)

开发者ID:wikiped,项目名称:pywebview,代码行数:9,代码来源:confirm_quit.py


示例14:

import webview

"""
This example demonstrates how to create a webview window.
"""

if __name__ == '__main__':
    # Create a non-resizable webview window with 800x600 dimensions
    webview.create_window("Simple browser", "http://www.flowrl.com", width=800, height=600, resizable=False)

开发者ID:gbtami,项目名称:pywebview,代码行数:9,代码来源:simple_browser.py


示例15: handle_event

              if evt.type in [X.KeyPress, X.KeyRelease]: #ignore X.MappingNotify(=34)
                 handle_event(evt)
              #else handle_event_pinyin(evt)

          data=''
          try:
              data, address=sock.recvfrom(4096)
              if data!='':
                  print 'receive udp:',data
                  #{"detail":"j", "state":0, "type":2}
                  #{"detail":"j", "state":0, "type":3}
                  evt_key=json.loads(data);
                  if is_on:
                      if evt_key['detail']=='f':
                          evt_key['detail']='s'
                      elif evt_key['detail']=='s':
                          evt_key['detail']='f'
                  evt_key={'detail':string_to_keycode(evt_key['detail']), 'state':evt_key['state'], 'type':evt_key['type']}
                  if evt_key['type']==5:
                      fake_input(disp, 2, evt_key['detail'])
                      fake_input(disp, 3, evt_key['detail'])
                  else:
                      fake_input(disp, evt_key['type'], evt_key['detail'])
                  #handle_event(namedtuple('Struct', evt_key.keys())(*evt_key.values()))
          except socket.error:
              continue

if __name__ == '__main__':
    thread.start_new_thread(main, ())
    webview.create_window('myboard_jack', 'https://www.google.com', None, screen.width_in_pixels-200, 0, False, False)
开发者ID:diyism,项目名称:MyBoard,代码行数:30,代码来源:myboard.py


示例16: url_ok

def url_ok(url, port):
    # Use httplib on Python 2
    try:
        from http.client import HTTPConnection
    except ImportError:
        from httplib import HTTPConnection

    try:
        conn = HTTPConnection(url, port)
        conn.request("GET", "/")
        r = conn.getresponse()
        return r.status == 200
    except:
        logger.exception("Server not started")
        return False

if __name__ == '__main__':
    logger.debug("Starting server")
    t = Thread(target=run_server)
    t.daemon = True
    t.start()
    logger.debug("Checking server")

    while not url_ok("127.0.0.1", 23948):
        sleep(0.1)

    logger.debug("Server started")
    webview.create_window("My first pywebview application",
                          "http://127.0.0.1:23948",
                          min_size=(640, 480))
开发者ID:r0x0r,项目名称:pywebview,代码行数:30,代码来源:main.py


示例17: save_file_dialog

import webview
import threading

"""
This example demonstrates creating a save file dialog.
"""

def save_file_dialog():
    import time
    time.sleep(5)
    print(webview.create_file_dialog(webview.SAVE_DIALOG, directory="/", save_filename='test.file'))


if __name__ == '__main__':
    t = threading.Thread(target=save_file_dialog)
    t.start()

    webview.create_window("Save file dialog", "http://www.flowrl.com")

开发者ID:gbtami,项目名称:pywebview,代码行数:18,代码来源:save_file_dialog.py


示例18: destroy

import webview
import threading
import time

"""
This example demonstrates how a webview window is created and destroyed
programmatically after 5 seconds.
"""


def destroy():
    # show the window for a few seconds before destroying it:
    time.sleep(5)

    print("Destroying window..")
    webview.destroy_window()
    print("Destroyed!")


if __name__ == '__main__':
    t = threading.Thread(target=destroy)
    t.start()
    webview.create_window("Destroy Window Example", "https://pywebview.flowrl.com/hello")
    print("Window is destroyed")
开发者ID:r0x0r,项目名称:pywebview,代码行数:24,代码来源:destroy_window.py


示例19: main_func

def main_func():
    webview.create_window('Simple browser test', 'https://www.example.org')
开发者ID:r0x0r,项目名称:pywebview,代码行数:2,代码来源:test_simple_browser.py


示例20: destroy

import webview
import threading

"""
This example demonstrates how a webview window is created and destroyed programmatically after 5 seconds
"""
#import os
#os.environ["USE_GTK"] = "true"

def destroy():
    import time
    time.sleep(5)
    print("Destroying window..")
    webview.destroy_window()


if __name__ == '__main__':
    t = threading.Thread(target=destroy)
    t.start()
    webview.create_window("Simple browser", "http://www.google.com")
    print("Window is destroyed")

开发者ID:gbtami,项目名称:pywebview,代码行数:21,代码来源:destroy_window.py



注:本文中的webview.create_window函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python wechat_sdk.WechatBasic类代码示例发布时间:2022-05-26
下一篇:
Python webutil.renamelink函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap