code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def __init__( self, *label, name=None, prefix_icon=None, suffix_icon=None, clear_icon=None, show_password_icon=None, hide_password_icon=None, **kwargs, ): """ The `*label` argument sets the text input's label. The kwarg...
The `*label` argument sets the text input's label. The kwargs suffixed by `_icon` each take an icon name and slot that icon into the respective slot.
__init__
python
hyperdiv/hyperdiv
hyperdiv/components/text_input.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/text_input.py
Apache-2.0
def is_light(self): """ Returns `True` if the theme is in light mode, and `False` if the theme is in dark mode, regardless of whether the theme mode is set by the user or follows system. """ if self.mode == "system": return self.system_mode == "light" ...
Returns `True` if the theme is in light mode, and `False` if the theme is in dark mode, regardless of whether the theme mode is set by the user or follows system.
is_light
python
hyperdiv/hyperdiv
hyperdiv/components/theme.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/theme.py
Apache-2.0
def __init__(self, *content, **kwargs): """ If `*content` is passed, it will be joined by `" "` and used to initialize the `content` prop. """ if content: kwargs["content"] = concat_text(content) super().__init__(**kwargs)
If `*content` is passed, it will be joined by `" "` and used to initialize the `content` prop.
__init__
python
hyperdiv/hyperdiv
hyperdiv/components/tooltip.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/tooltip.py
Apache-2.0
def __init__( self, expand_icon_name=None, collapse_icon_name=None, **kwargs, ): """ @component(icon) names can be passed in `expand_icon_name` or `collapse_icon_name` to customize the expand and collapse icons of all expandable tree nodes. The icons w...
@component(icon) names can be passed in `expand_icon_name` or `collapse_icon_name` to customize the expand and collapse icons of all expandable tree nodes. The icons will automatically placed in their respective slots. The rest of `**kwargs` are passed to `Component`.
__init__
python
hyperdiv/hyperdiv
hyperdiv/components/tree.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/tree.py
Apache-2.0
def selected_items(self): """ Returns the complete list of the @component(tree_item) children that are currently selected. """ children = [] def collect_children(node): for c in node.children: if isinstance(c, tree_item): ...
Returns the complete list of the @component(tree_item) children that are currently selected.
selected_items
python
hyperdiv/hyperdiv
hyperdiv/components/tree.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/tree.py
Apache-2.0
def __init__( self, *label, expand_icon_name=None, collapse_icon_name=None, **kwargs, ): """ @component(icon) names can be passed in `expand_icon_name` or `collapse_icon_name` to customize the expand and collapse icons of this specific three no...
@component(icon) names can be passed in `expand_icon_name` or `collapse_icon_name` to customize the expand and collapse icons of this specific three node. The icons will automatically placed in their respective slots. These icons override icons set in the parent @component(tree...
__init__
python
hyperdiv/hyperdiv
hyperdiv/components/tree_item.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/tree_item.py
Apache-2.0
def bar_chart( *datasets, labels=None, colors=None, grid_color="neutral-100", x_axis="linear", y_axis="linear", hide_legend=False, show_x_tick_labels=True, show_y_tick_labels=True, y_min=None, y_max=None, **kwargs, ): """ A @component(cartesian_chart) that renders...
A @component(cartesian_chart) that renders datasets as bars. ```py hd.bar_chart( (1, 18, 4), (4, 2, 28), labels=("Jim", "Mary") ) ```
bar_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/bar_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/bar_chart.py
Apache-2.0
def bubble_chart( *datasets, labels=None, colors=None, grid_color="neutral-100", x_axis="linear", y_axis="linear", hide_legend=False, show_x_tick_labels=True, show_y_tick_labels=True, y_min=None, y_max=None, **kwargs, ): """ A @component(cartesian_chart) that rend...
A @component(cartesian_chart) that renders datasets as bubble points. It works like @component(scatter_chart), but you can specify the visual size of the points by providing an extra `r` component for each point, which specifies the radius of the bubble in pixels. ```py hd.bubble_chart( ...
bubble_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/bubble_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/bubble_chart.py
Apache-2.0
def cartesian_chart( chart_type, *datasets, labels=None, colors=None, grid_color="neutral-100", x_axis="linear", y_axis="linear", hide_legend=False, show_x_tick_labels=True, show_y_tick_labels=True, y_min=None, y_max=None, **kwargs, ): """ ## Introduction ...
## Introduction `cartesian_chart` is the base chart constructor used by @component(line_chart), @component(bar_chart), @component(scatter_chart), and @component(bubble_chart). All these charts work fundamentally similarly in that they render `x`/`y` data on a grid. They only differ in how the ...
cartesian_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/cartesian_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/cartesian_chart.py
Apache-2.0
def line_chart( *datasets, labels=None, colors=None, grid_color="neutral-100", x_axis="linear", y_axis="linear", hide_legend=False, show_x_tick_labels=True, show_y_tick_labels=True, y_min=None, y_max=None, **kwargs, ): """ A @component(cartesian_chart) that render...
A @component(cartesian_chart) that renders datasets as points connected by lines. ```py hd.line_chart( (1, 18, 4), (4, 2, 28), labels=("Jim", "Mary") ) ```
line_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/line_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/line_chart.py
Apache-2.0
def pie_chart( dataset, labels=None, colors=None, hide_legend=False, doughnut=True, **kwargs, ): """ A good ol pie chart. `dataset` holds the numeric sizes of the slices. ```py hd.pie_chart((1, 3, 12, 8)) ``` `labels` gives names to the pie slices, order. And `color...
A good ol pie chart. `dataset` holds the numeric sizes of the slices. ```py hd.pie_chart((1, 3, 12, 8)) ``` `labels` gives names to the pie slices, order. And `colors` specifies custom colors, in the same order. When you set `labels`, the clickable legend will automatically be rendere...
pie_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/pie_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/pie_chart.py
Apache-2.0
def polar_chart( dataset, labels=None, colors=None, grid_color="neutral-100", hide_legend=False, show_tick_labels=True, r_min=None, r_max=None, **kwargs, ): """ A polar chart component. This works like @component(pie_chart) but unlike a pie chart, which shows dataset diff...
A polar chart component. This works like @component(pie_chart) but unlike a pie chart, which shows dataset differences in the *angles* of the slices, the polar chart keeps the angles identical and emphasizes difference in the slice "lengths". The `labels` argument specifies the name of each slice,...
polar_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/polar_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/polar_chart.py
Apache-2.0
def scatter_chart( *datasets, labels=None, colors=None, grid_color="neutral-100", x_axis="linear", y_axis="linear", hide_legend=False, show_x_tick_labels=True, show_y_tick_labels=True, y_min=None, y_max=None, **kwargs, ): """ A @component(cartesian_chart) that ren...
A @component(cartesian_chart) that renders datasets as points. ```py hd.scatter_chart( (1, 18, 4), (4, 2, 28), labels=("Jim", "Mary") ) ```
scatter_chart
python
hyperdiv/hyperdiv
hyperdiv/components/charts/scatter_chart.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/charts/scatter_chart.py
Apache-2.0
def __init__(self, *label, **kwargs): """ If `*label` is provided, it will be concatenated by spaces and stored as a `text` or `plaintext` component in the component's body. If `*label` is not provided, it is assumed the caller will store the label explicitly. `...
If `*label` is provided, it will be concatenated by spaces and stored as a `text` or `plaintext` component in the component's body. If `*label` is not provided, it is assumed the caller will store the label explicitly. `**kwargs` are passed up to @component(Component)....
__init__
python
hyperdiv/hyperdiv
hyperdiv/components/common/label_component.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/common/label_component.py
Apache-2.0
def label(self): """ Reads/writes the label. If the label slot has been manually populated by the user with something other than a text or plaintext component, reading this property returns `None`, and writing it does nothing. """ item = self._find_plaintext_chil...
Reads/writes the label. If the label slot has been manually populated by the user with something other than a text or plaintext component, reading this property returns `None`, and writing it does nothing.
label
python
hyperdiv/hyperdiv
hyperdiv/components/common/label_component.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/common/label_component.py
Apache-2.0
def __init__(self, src=None, **kwargs): """ `src` is a local or remote path to an audio file. If `src` is provided, a @component(media_source) will automatically be created. """ super().__init__(**kwargs) if src: with self: media_sourc...
`src` is a local or remote path to an audio file. If `src` is provided, a @component(media_source) will automatically be created.
__init__
python
hyperdiv/hyperdiv
hyperdiv/components/common/media_base.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/components/common/media_base.py
Apache-2.0
def __init__( self, data, id_column_name=None, show_id_column=True, rows_per_page=10, show_pagination=True, row_actions=None, show_select_column=False, vertical_scroll=False, **kwargs, ): """ Parameters: * `data...
Parameters: * `data`: The data dictionary to be rendered in the table. It maps column names to the row value of each column. * `id_column_name`: Specifies a column name, from `data`, which identifies each row uniquely. You need to specify this argument if you use...
__init__
python
hyperdiv/hyperdiv
hyperdiv/ext/data_table.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/data_table.py
Apache-2.0
def __init__( self, icon_name, name, href, responsive_threshold=650, font_size="small", font_color="neutral-700", border_radius="medium", hover_background_color="neutral-100", direction="horizontal", align="center", gap=0.5,...
Parameters: * `icon_name`: The icon to render in the link. * `name`: The rendered name of the link. * `href`: The linked URL or path. * `responsive_threshold`: The window width, in pixels, below which the link name is rendered in a tooltip, instead of being ...
__init__
python
hyperdiv/hyperdiv
hyperdiv/ext/icon_link.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/icon_link.py
Apache-2.0
def link_group(links, drawer=None): """ Renders a group of links. This is usually the whole menu, in flat menus, or the link group within a menu section, in hierarchical menus. If an optional `drawer` is passed, the drawer is closed when a link is clicked. """ active_route = get_active_...
Renders a group of links. This is usually the whole menu, in flat menus, or the link group within a menu section, in hierarchical menus. If an optional `drawer` is passed, the drawer is closed when a link is clicked.
link_group
python
hyperdiv/hyperdiv
hyperdiv/ext/navigation_menu.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/navigation_menu.py
Apache-2.0
def nav_section(name, links, drawer=None, expanded=False): """ Renders a collapsible section, including the section title and expand/collapse logic. """ state = hd.state(expanded=expanded) active_route = get_active_route(links) if active_route: state.expanded = True with hd.box...
Renders a collapsible section, including the section title and expand/collapse logic.
nav_section
python
hyperdiv/hyperdiv
hyperdiv/ext/navigation_menu.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/navigation_menu.py
Apache-2.0
def navigation_menu(link_dict, drawer=None, expanded=False): """ Renders a navigation menu component. The menu is wrapped in a @component(nav) and uses @component(link) for each link. `link_dict` is a dictionary specifying the menu, which can be either a flat menu, or a two-level hierarchical menu....
Renders a navigation menu component. The menu is wrapped in a @component(nav) and uses @component(link) for each link. `link_dict` is a dictionary specifying the menu, which can be either a flat menu, or a two-level hierarchical menu. `drawer` is an optional @component(drawer). If a drawer is pas...
navigation_menu
python
hyperdiv/hyperdiv
hyperdiv/ext/navigation_menu.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/navigation_menu.py
Apache-2.0
def route(self, path, redirect_from=None): """The main decorator for defining routes: ```py-nodemo @router.route("/foo") def foo(): hd.text("The foo page.") ``` `redirect_from` can be a tuple of paths, such that if the user navigates to any those pat...
The main decorator for defining routes: ```py-nodemo @router.route("/foo") def foo(): hd.text("The foo page.") ``` `redirect_from` can be a tuple of paths, such that if the user navigates to any those paths, they will be redirected to this route. ...
route
python
hyperdiv/hyperdiv
hyperdiv/ext/router.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/router.py
Apache-2.0
def not_found(self): """ A decorator for defining a custom "Not Found" page, to be rendered when a user navigates to an undefined path. ```py-nodemo @router.not_found def my_custom_not_found_page(): with hd.box(gap=1): hd.markdown("# Not Found...
A decorator for defining a custom "Not Found" page, to be rendered when a user navigates to an undefined path. ```py-nodemo @router.not_found def my_custom_not_found_page(): with hd.box(gap=1): hd.markdown("# Not Found") hd.text("Ther...
not_found
python
hyperdiv/hyperdiv
hyperdiv/ext/router.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/router.py
Apache-2.0
def render_not_found(self): """ This method can be used to programmatically invoke the `not_found` route. ```py-nodemo @router("/users/{user_id}") def user(user_id): u = get_user(user_id) if not u: router.render_not_found() els...
This method can be used to programmatically invoke the `not_found` route. ```py-nodemo @router("/users/{user_id}") def user(user_id): u = get_user(user_id) if not u: router.render_not_found() else: hd.text(u.name) ...
render_not_found
python
hyperdiv/hyperdiv
hyperdiv/ext/router.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/router.py
Apache-2.0
def run(self): """ Calls the correct route function based on the current @component(location) path. If there is no route corresponding to the current path, it renders the `not_found` route. """ loc = hd.location() fn = self.routes.get(loc.path) if fn: ...
Calls the correct route function based on the current @component(location) path. If there is no route corresponding to the current path, it renders the `not_found` route.
run
python
hyperdiv/hyperdiv
hyperdiv/ext/router.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/router.py
Apache-2.0
def __init__( self, logo=None, title=None, sidebar=True, theme_switcher=True, responsive_threshold=1000, responsive_topbar_links_threshold=600, ): """ Parameters: * `logo`: The path to a logo image, e.g. `/assets/logo.svg`. T...
Parameters: * `logo`: The path to a logo image, e.g. `/assets/logo.svg`. The logo will be rendered in the top-left corner of the app. * `title`: The title of the app, rendered in the top-left next to the logo. * `sidebar`: Whether to render a sidebar. ...
__init__
python
hyperdiv/hyperdiv
hyperdiv/ext/template.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/template.py
Apache-2.0
def add_sidebar_menu(self, link_dict, expanded=False): """ Adds a @component(navigation_menu) to the sidebar. `link_dict` is passed to @component(navigation_menu) to construct the menu and add it to the sidebar container. The template's `drawer` property is passed into the navig...
Adds a @component(navigation_menu) to the sidebar. `link_dict` is passed to @component(navigation_menu) to construct the menu and add it to the sidebar container. The template's `drawer` property is passed into the navigation menu as its `drawer` kwarg, so the drawer is auto-cl...
add_sidebar_menu
python
hyperdiv/hyperdiv
hyperdiv/ext/template.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/template.py
Apache-2.0
def add_topbar_link(self, icon, name, href): """ Adds a @component(icon_link) component to the `topbar_links` container. The `icon`, `name`, and `href` components are passed to the @component(icon_link) constructor. The app template's `responsive_topbar_links_threshold` setting ...
Adds a @component(icon_link) component to the `topbar_links` container. The `icon`, `name`, and `href` components are passed to the @component(icon_link) constructor. The app template's `responsive_topbar_links_threshold` setting is passed down as @component(icon_link)'s ...
add_topbar_link
python
hyperdiv/hyperdiv
hyperdiv/ext/template.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/template.py
Apache-2.0
def add_topbar_links(self, link_dict): """ Adds multiple @component(icon_link) components to the `topbar_links` container in one shot. The `link_dict` syntax is the same as the `linked_dict` passed to @component(navigation_menu), but only flat menus are supported in this...
Adds multiple @component(icon_link) components to the `topbar_links` container in one shot. The `link_dict` syntax is the same as the `linked_dict` passed to @component(navigation_menu), but only flat menus are supported in this case.
add_topbar_links
python
hyperdiv/hyperdiv
hyperdiv/ext/template.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/template.py
Apache-2.0
def theme_switcher(icon_font_size="medium"): """ Renders a theme switcher inline icon and dropdown menu. When the icon is clicked, the dropdown menu opens with Dark/Light/System choices. The icon is a "moon" icon in dark mode and a "sun" icon in light mode. This menu remembers the user's settin...
Renders a theme switcher inline icon and dropdown menu. When the icon is clicked, the dropdown menu opens with Dark/Light/System choices. The icon is a "moon" icon in dark mode and a "sun" icon in light mode. This menu remembers the user's setting in browser local storage, so if a user chooses...
theme_switcher
python
hyperdiv/hyperdiv
hyperdiv/ext/theme_switcher.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/ext/theme_switcher.py
Apache-2.0
def render(self, value): """Specialized render function for floats. We need this because `json` will render float('inf') and float('-inf') as special constants that don't correspond to anything in JS. The strings "+Infinity" and "-Infinity" behave correctly when coerced to numbe...
Specialized render function for floats. We need this because `json` will render float('inf') and float('-inf') as special constants that don't correspond to anything in JS. The strings "+Infinity" and "-Infinity" behave correctly when coerced to numbers on the JS side.
render
python
hyperdiv/hyperdiv
hyperdiv/prop_types/float_type.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/prop_types/float_type.py
Apache-2.0
def __init__(self, typ, name=None, coercible_types=None): """ `typ` should be a Python type. `coercible_types` is a list of additional accepted types. However, the final value will be coerced to `typ`. `name` is an optional name. By default, a name will be derived from `...
`typ` should be a Python type. `coercible_types` is a list of additional accepted types. However, the final value will be coerced to `typ`. `name` is an optional name. By default, a name will be derived from `typ`.
__init__
python
hyperdiv/hyperdiv
hyperdiv/prop_types/native.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/prop_types/native.py
Apache-2.0
def test_click_twice(): """ Test that an update batch containing updates to the same prop schedules those updates in different frames. """ button_key = None text_key = None def my_app(): nonlocal button_key, text_key s = state(count=0) b = button("Click Me") ...
Test that an update batch containing updates to the same prop schedules those updates in different frames.
test_click_twice
python
hyperdiv/hyperdiv
hyperdiv/tests/app_runner_tests.py
https://github.com/hyperdiv/hyperdiv/blob/master/hyperdiv/tests/app_runner_tests.py
Apache-2.0
def instance(cls) -> '_AutomationClient': """Singleton instance (this prevents com creation on import).""" if cls._instance is None: cls._instance = cls() return cls._instance
Singleton instance (this prevents com creation on import).
instance
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def instance(cls) -> '_DllClient': """Singleton instance (this prevents com creation on import).""" if cls._instance is None: cls._instance = cls() return cls._instance
Singleton instance (this prevents com creation on import).
instance
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetClipboardText(text: str) -> bool: """ Return bool, True if succeed otherwise False. """ if ctypes.windll.user32.OpenClipboard(0): ctypes.windll.user32.EmptyClipboard() textByteLen = (len(text) + 1) * 2 hClipboardData = ctypes.windll.kernel32.GlobalAlloc(0, textByteLen) # ...
Return bool, True if succeed otherwise False.
SetClipboardText
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetConsoleColor(color: int) -> bool: """ Change the text color on console window. color: int, a value in class `ConsoleColor`. Return bool, True if succeed otherwise False. """ global _ConsoleOutputHandle global _DefaultConsoleColor if not _DefaultConsoleColor: if not _Consol...
Change the text color on console window. color: int, a value in class `ConsoleColor`. Return bool, True if succeed otherwise False.
SetConsoleColor
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def ResetConsoleColor() -> bool: """ Reset to the default text color on console window. Return bool, True if succeed otherwise False. """ if sys.stdout: sys.stdout.flush() return bool(ctypes.windll.kernel32.SetConsoleTextAttribute(_ConsoleOutputHandle, ctypes.c_ushort(_DefaultConsoleColo...
Reset to the default text color on console window. Return bool, True if succeed otherwise False.
ResetConsoleColor
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetCursorPos() -> Tuple[int, int]: """ GetCursorPos from Win32. Get current mouse cursor positon. Return Tuple[int, int], two ints tuple (x, y). """ point = ctypes.wintypes.POINT(0, 0) ctypes.windll.user32.GetCursorPos(ctypes.byref(point)) return point.x, point.y
GetCursorPos from Win32. Get current mouse cursor positon. Return Tuple[int, int], two ints tuple (x, y).
GetCursorPos
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Click(x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse click at point x, y. x: int. y: int. waitTime: float. """ SetCursorPos(x, y) screenWidth, screenHeight = GetScreenSize() mouse_event(MouseEventFlag.LeftDown | MouseEventFlag.Absolute, x * 655...
Simulate mouse click at point x, y. x: int. y: int. waitTime: float.
Click
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def MiddleClick(x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse middle click at point x, y. x: int. y: int. waitTime: float. """ SetCursorPos(x, y) screenWidth, screenHeight = GetScreenSize() mouse_event(MouseEventFlag.MiddleDown | MouseEventFlag.Ab...
Simulate mouse middle click at point x, y. x: int. y: int. waitTime: float.
MiddleClick
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def RightClick(x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse right click at point x, y. x: int. y: int. waitTime: float. """ SetCursorPos(x, y) screenWidth, screenHeight = GetScreenSize() mouse_event(MouseEventFlag.RightDown | MouseEventFlag.Absol...
Simulate mouse right click at point x, y. x: int. y: int. waitTime: float.
RightClick
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def PressMouse(x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Press left mouse. x: int. y: int. waitTime: float. """ SetCursorPos(x, y) screenWidth, screenHeight = GetScreenSize() mouse_event(MouseEventFlag.LeftDown | MouseEventFlag.Absolute, x * 65535 // screenW...
Press left mouse. x: int. y: int. waitTime: float.
PressMouse
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def RightPressMouse(x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Press right mouse. x: int. y: int. waitTime: float. """ SetCursorPos(x, y) screenWidth, screenHeight = GetScreenSize() mouse_event(MouseEventFlag.RightDown | MouseEventFlag.Absolute, x * 65535 // ...
Press right mouse. x: int. y: int. waitTime: float.
RightPressMouse
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def MiddlePressMouse(x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Press middle mouse. x: int. y: int. waitTime: float. """ SetCursorPos(x, y) screenWidth, screenHeight = GetScreenSize() mouse_event(MouseEventFlag.MiddleDown | MouseEventFlag.Absolute, x * 65535 ...
Press middle mouse. x: int. y: int. waitTime: float.
MiddlePressMouse
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def MoveTo(x: int, y: int, moveSpeed: float = 1, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse move to point x, y from current cursor. x: int. y: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 move faster. waitTime: float. """ if moveSpeed <= 0: ...
Simulate mouse move to point x, y from current cursor. x: int. y: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 move faster. waitTime: float.
MoveTo
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def DragDrop(x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse left button drag from point x1, y1 drop to point x2, y2. x1: int. y1: int. x2: int. y2: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 move f...
Simulate mouse left button drag from point x1, y1 drop to point x2, y2. x1: int. y1: int. x2: int. y2: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 move faster. waitTime: float.
DragDrop
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def RightDragDrop(x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse right button drag from point x1, y1 drop to point x2, y2. x1: int. y1: int. x2: int. y2: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 ...
Simulate mouse right button drag from point x1, y1 drop to point x2, y2. x1: int. y1: int. x2: int. y2: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 move faster. waitTime: float.
RightDragDrop
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def MiddleDragDrop(x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse middle button drag from point x1, y1 drop to point x2, y2. x1: int. y1: int. x2: int. y2: int. moveSpeed: float, 1 normal speed, < 1 move slower, > ...
Simulate mouse middle button drag from point x1, y1 drop to point x2, y2. x1: int. y1: int. x2: int. y2: int. moveSpeed: float, 1 normal speed, < 1 move slower, > 1 move faster. waitTime: float.
MiddleDragDrop
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def WheelDown(wheelTimes: int = 1, interval: float = 0.05, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse wheel down. wheelTimes: int. interval: float. waitTime: float. """ for i in range(wheelTimes): mouse_event(MouseEventFlag.Wheel, 0, 0, -120, 0) #WHEEL_DELT...
Simulate mouse wheel down. wheelTimes: int. interval: float. waitTime: float.
WheelDown
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def WheelUp(wheelTimes: int = 1, interval: float = 0.05, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate mouse wheel up. wheelTimes: int. interval: float. waitTime: float. """ for i in range(wheelTimes): mouse_event(MouseEventFlag.Wheel, 0, 0, 120, 0) #WHEEL_DELTA=120 ...
Simulate mouse wheel up. wheelTimes: int. interval: float. waitTime: float.
WheelUp
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetDpiAwareness(dpiAwarenessPerMonitor: bool = True) -> int: ''' Call SetThreadDpiAwarenessContext(Windows 10 version 1607+) or SetProcessDpiAwareness(Windows 8.1+). You should call this function with True if you enable DPI scaling. uiautomation calls this function when it initializes. dpiAwarenessP...
Call SetThreadDpiAwarenessContext(Windows 10 version 1607+) or SetProcessDpiAwareness(Windows 8.1+). You should call this function with True if you enable DPI scaling. uiautomation calls this function when it initializes. dpiAwarenessPerMonitor: bool. Return int.
SetDpiAwareness
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetScreenSize(dpiAwarenessPerMonitor: bool = True) -> Tuple[int, int]: """ dpiAwarenessPerMonitor: bool. Return Tuple[int, int], two ints tuple (width, height). """ SetDpiAwareness(dpiAwarenessPerMonitor) SM_CXSCREEN = 0 SM_CYSCREEN = 1 w = ctypes.windll.user32.GetSystemMetrics(SM_CX...
dpiAwarenessPerMonitor: bool. Return Tuple[int, int], two ints tuple (width, height).
GetScreenSize
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetVirtualScreenSize(dpiAwarenessPerMonitor: bool = True) -> Tuple[int, int]: """ dpiAwarenessPerMonitor: bool. Return Tuple[int, int], two ints tuple (width, height). """ SetDpiAwareness(dpiAwarenessPerMonitor) SM_CXVIRTUALSCREEN = 78 SM_CYVIRTUALSCREEN = 79 w = ctypes.windll.user32...
dpiAwarenessPerMonitor: bool. Return Tuple[int, int], two ints tuple (width, height).
GetVirtualScreenSize
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetMonitorsRect(dpiAwarenessPerMonitor: bool = False) -> List[Rect]: """ Get monitors' rect. dpiAwarenessPerMonitor: bool. Return List[Rect]. """ SetDpiAwareness(dpiAwarenessPerMonitor) MonitorEnumProc = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_size_t, ctypes.c_size_t, ctypes.POINTER(ct...
Get monitors' rect. dpiAwarenessPerMonitor: bool. Return List[Rect].
GetMonitorsRect
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetPixelColor(x: int, y: int, handle: int = 0) -> int: """ Get pixel color of a native window. x: int. y: int. handle: int, the handle of a native window. Return int, the bgr value of point (x,y). r = bgr & 0x0000FF g = (bgr & 0x00FF00) >> 8 b = (bgr & 0xFF0000) >> 16 If hand...
Get pixel color of a native window. x: int. y: int. handle: int, the handle of a native window. Return int, the bgr value of point (x,y). r = bgr & 0x0000FF g = (bgr & 0x00FF00) >> 8 b = (bgr & 0xFF0000) >> 16 If handle is 0, get pixel from Desktop window(root control). Note: ...
GetPixelColor
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetWindowTopmost(handle: int, isTopmost: bool) -> bool: """ handle: int, the handle of a native window. isTopmost: bool Return bool, True if succeed otherwise False. """ topValue = SWP.HWND_Topmost if isTopmost else SWP.HWND_NoTopmost return bool(SetWindowPos(handle, topValue, 0, 0, 0, 0...
handle: int, the handle of a native window. isTopmost: bool Return bool, True if succeed otherwise False.
SetWindowTopmost
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetWindowText(handle: int) -> str: """ GetWindowText from Win32. handle: int, the handle of a native window. Return str. """ arrayType = ctypes.c_wchar * MAX_PATH values = arrayType() ctypes.windll.user32.GetWindowTextW(ctypes.c_void_p(handle), values, ctypes.c_int(MAX_PATH)) ret...
GetWindowText from Win32. handle: int, the handle of a native window. Return str.
GetWindowText
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetEditText(handle: int) -> str: """ Get text of a native Win32 Edit. handle: int, the handle of a native window. Return str. """ textLen = SendMessage(handle, 0x000E, 0, 0) + 1 #WM_GETTEXTLENGTH arrayType = ctypes.c_wchar * textLen values = arrayType() SendMessage(handle, 0x000...
Get text of a native Win32 Edit. handle: int, the handle of a native window. Return str.
GetEditText
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetConsoleOriginalTitle() -> str: """ GetConsoleOriginalTitle from Win32. Return str. Only available on Windows Vista or higher. """ if IsNT6orHigher: arrayType = ctypes.c_wchar * MAX_PATH values = arrayType() ctypes.windll.kernel32.GetConsoleOriginalTitleW(values, ct...
GetConsoleOriginalTitle from Win32. Return str. Only available on Windows Vista or higher.
GetConsoleOriginalTitle
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def IsDesktopLocked() -> bool: """ Check if desktop is locked. Return bool. Desktop is locked if press Win+L, Ctrl+Alt+Del or in remote desktop mode. """ isLocked = False desk = ctypes.windll.user32.OpenDesktopW(ctypes.c_wchar_p('Default'), ctypes.c_uint(0), ctypes.c_int(0), ctypes.c_uint(0x...
Check if desktop is locked. Return bool. Desktop is locked if press Win+L, Ctrl+Alt+Del or in remote desktop mode.
IsDesktopLocked
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def PlayWaveFile(filePath: str = r'C:\Windows\Media\notify.wav', isAsync: bool = False, isLoop: bool = False) -> bool: """ Call PlaySound from Win32. filePath: str, if emtpy, stop playing the current sound. isAsync: bool, if True, the sound is played asynchronously and returns immediately. isLoop: b...
Call PlaySound from Win32. filePath: str, if emtpy, stop playing the current sound. isAsync: bool, if True, the sound is played asynchronously and returns immediately. isLoop: bool, if True, the sound plays repeatedly until PlayWaveFile(None) is called again, must also set isAsync to True. Return b...
PlayWaveFile
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def IsProcess64Bit(processId: int) -> bool: """ Return True if process is 64 bit. Return False if process is 32 bit. Return None if unknown, maybe caused by having no acess right to the process. """ try: func = ctypes.windll.ntdll.ZwWow64ReadVirtualMemory64 #only 64 bit OS has this func...
Return True if process is 64 bit. Return False if process is 32 bit. Return None if unknown, maybe caused by having no acess right to the process.
IsProcess64Bit
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def RunScriptAsAdmin(argv: List[str], workingDirectory: str = None, showFlag: int = SW.ShowNormal) -> bool: """ Run a python script as administrator. System will show a popup dialog askes you whether to elevate as administrator if UAC is enabled. argv: List[str], a str list like sys.argv, argv[0] is the...
Run a python script as administrator. System will show a popup dialog askes you whether to elevate as administrator if UAC is enabled. argv: List[str], a str list like sys.argv, argv[0] is the script file, argv[1:] are other arguments. workingDirectory: str, the working directory for the script file. ...
RunScriptAsAdmin
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SendKey(key: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Simulate typing a key. key: int, a value in class `Keys`. """ keybd_event(key, 0, KeyboardEventFlag.KeyDown | KeyboardEventFlag.ExtendedKey, 0) keybd_event(key, 0, KeyboardEventFlag.KeyUp | KeyboardEventFlag.ExtendedKey, 0...
Simulate typing a key. key: int, a value in class `Keys`.
SendKey
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def IsKeyPressed(key: int) -> bool: """ key: int, a value in class `Keys`. Return bool. """ state = ctypes.windll.user32.GetAsyncKeyState(key) return bool(state & 0x8000)
key: int, a value in class `Keys`. Return bool.
IsKeyPressed
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def _CreateInput(structure) -> INPUT: """ Create Win32 struct `INPUT` for `SendInput`. Return `INPUT`. """ if isinstance(structure, MOUSEINPUT): return INPUT(InputType.Mouse, _INPUTUnion(mi=structure)) if isinstance(structure, KEYBDINPUT): return INPUT(InputType.Keyboard, _INPUTU...
Create Win32 struct `INPUT` for `SendInput`. Return `INPUT`.
_CreateInput
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SendInput(*inputs) -> int: """ SendInput from Win32. input: `INPUT`. Return int, the number of events that it successfully inserted into the keyboard or mouse input stream. If the function returns zero, the input was already blocked by another thread. """ cbSize = ctypes.c_in...
SendInput from Win32. input: `INPUT`. Return int, the number of events that it successfully inserted into the keyboard or mouse input stream. If the function returns zero, the input was already blocked by another thread.
SendInput
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SendUnicodeChar(char: str, charMode: bool = True) -> int: """ Type a single unicode char. char: str, len(char) must equal to 1. charMode: bool, if False, the char typied is depend on the input method if a input method is on. Return int, the number of events that it successfully inserted into the...
Type a single unicode char. char: str, len(char) must equal to 1. charMode: bool, if False, the char typied is depend on the input method if a input method is on. Return int, the number of events that it successfully inserted into the keyboard or mouse input stream. If the function retu...
SendUnicodeChar
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def _VKtoSC(key: int) -> int: """ This function is only for internal use in SendKeys. key: int, a value in class `Keys`. Return int. """ if key in _SCKeys: return _SCKeys[key] scanCode = ctypes.windll.user32.MapVirtualKeyA(key, 0) if not scanCode: return 0 keyList = [...
This function is only for internal use in SendKeys. key: int, a value in class `Keys`. Return int.
_VKtoSC
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SendKeys(text: str, interval: float = 0.01, waitTime: float = OPERATION_WAIT_TIME, charMode: bool = True, debug: bool = False) -> None: """ Simulate typing keys on keyboard. text: str, keys to type. interval: float, seconds between keys. waitTime: float. charMode: bool, if False, the text ty...
Simulate typing keys on keyboard. text: str, keys to type. interval: float, seconds between keys. waitTime: float. charMode: bool, if False, the text typied is depend on the input method if a input method is on. debug: bool, if True, print the keys. Examples: {Ctrl}, {Delete} ... are sp...
SendKeys
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Write(log: Any, consoleColor: int = ConsoleColor.Default, writeToFile: bool = True, printToStdout: bool = True, logFile: str = None, printTruncateLen: int = 0) -> None: """ log: any type. consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`. writeToFil...
log: any type. consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`. writeToFile: bool. printToStdout: bool. logFile: str, log file path. printTruncateLen: int, if <= 0, log is not truncated when print.
Write
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def ColorfullyWrite(log: str, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: str = None) -> None: """ log: str. consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`. writeToFile: bool. printToStdout: bool. ...
log: str. consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`. writeToFile: bool. printToStdout: bool. logFile: str, log file path. ColorfullyWrite('Hello <Color=Green>Green</Color> !!!'), color name must be in Logger.ColorNames.
ColorfullyWrite
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Log(log: Any = '', consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: str = None) -> None: """ log: any type. consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`. writeToFile: bool. printToStdout: bool. ...
log: any type. consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`. writeToFile: bool. printToStdout: bool. logFile: str, log file path.
Log
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def ColorfullyLog(log: str = '', consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: str = None) -> None: """ log: any type. consoleColor: int, a value in class ConsoleColor, such as ConsoleColor.DarkGreen. writeToFile: bool. printToStdout: bool...
log: any type. consoleColor: int, a value in class ConsoleColor, such as ConsoleColor.DarkGreen. writeToFile: bool. printToStdout: bool. logFile: str, log file path. ColorfullyLog('Hello <Color=Green>Green</Color> !!!'), color name must be in Logger.ColorNames
ColorfullyLog
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def __init__(self, width: int = 0, height: int = 0): """ Create a black bimap of size(width, height). """ self._width = width self._height = height self._bitmap = 0 if width > 0 and height > 0: self._bitmap = _DllClient.instance().dll.BitmapCreate(widt...
Create a black bimap of size(width, height).
__init__
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def FromHandle(self, hwnd: int, left: int = 0, top: int = 0, right: int = 0, bottom: int = 0) -> bool: """ Capture a native window to Bitmap by its handle. hwnd: int, the handle of a native window. left: int. top: int. right: int. bottom: int. left, top, r...
Capture a native window to Bitmap by its handle. hwnd: int, the handle of a native window. left: int. top: int. right: int. bottom: int. left, top, right and bottom are control's internal postion(from 0,0). Return bool, True if succeed otherwise False. ...
FromHandle
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def FromControl(self, control: 'Control', x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool: """ Capture a control to Bitmap. control: `Control` or its subclass. x: int. y: int. width: int. height: int. x, y: the point in control's internal ...
Capture a control to Bitmap. control: `Control` or its subclass. x: int. y: int. width: int. height: int. x, y: the point in control's internal position(from 0,0) width, height: image's width and height from x, y, use 0 for entire area, If width(o...
FromControl
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def FromFile(self, filePath: str) -> bool: """ Load image from a file. filePath: str. Return bool, True if succeed otherwise False. """ self.Release() self._bitmap = _DllClient.instance().dll.BitmapFromFile(ctypes.c_wchar_p(filePath)) self._getsize() ...
Load image from a file. filePath: str. Return bool, True if succeed otherwise False.
FromFile
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def ToFile(self, savePath: str) -> bool: """ Save to a file. savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff. Return bool, True if succeed otherwise False. """ name, ext = os.path.splitext(savePath) extMap = {'.bmp': 'image/bmp' ...
Save to a file. savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff. Return bool, True if succeed otherwise False.
ToFile
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetPixelColorsHorizontally(self, x: int, y: int, count: int) -> ctypes.Array: """ x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y horizontally. """ arrayType = ctypes.c_uint32 * count values = a...
x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y horizontally.
GetPixelColorsHorizontally
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetPixelColorsHorizontally(self, x: int, y: int, colors: Iterable[int]) -> bool: """ Set pixel colors form x,y horizontally. x: int. y: int. colors: Iterable[int], an iterable list of int color values in argb. Return bool, True if succeed otherwise False. """ ...
Set pixel colors form x,y horizontally. x: int. y: int. colors: Iterable[int], an iterable list of int color values in argb. Return bool, True if succeed otherwise False.
SetPixelColorsHorizontally
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetPixelColorsVertically(self, x: int, y: int, count: int) -> ctypes.Array: """ x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y vertically. """ arrayType = ctypes.c_uint32 * count values = array...
x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y vertically.
GetPixelColorsVertically
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetPixelColorsVertically(self, x: int, y: int, colors: Iterable[int]) -> bool: """ Set pixel colors form x,y vertically. x: int. y: int. colors: Iterable[int], an iterable list of int color values in argb. Return bool, True if succeed otherwise False. """ ...
Set pixel colors form x,y vertically. x: int. y: int. colors: Iterable[int], an iterable list of int color values in argb. Return bool, True if succeed otherwise False.
SetPixelColorsVertically
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetPixelColorsOfRect(self, x: int, y: int, width: int, height: int) -> ctypes.Array: """ x: int. y: int. width: int. height: int. Return `ctypes.Array`, an iterable array of int values in argb of the input rect. """ arrayType = ctypes.c_uint32 * (width...
x: int. y: int. width: int. height: int. Return `ctypes.Array`, an iterable array of int values in argb of the input rect.
GetPixelColorsOfRect
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetPixelColorsOfRect(self, x: int, y: int, width: int, height: int, colors: Iterable[int]) -> bool: """ x: int. y: int. width: int. height: int. colors: Iterable[int], an iterable list of int values in argb, it's length must equal to width*height. Return bool....
x: int. y: int. width: int. height: int. colors: Iterable[int], an iterable list of int values in argb, it's length must equal to width*height. Return bool.
SetPixelColorsOfRect
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetPixelColorsOfRects(self, rects: List[Tuple[int, int, int, int]]) -> List[ctypes.Array]: """ rects: List[Tuple[int, int, int, int]], such as [(0,0,10,10), (10,10,20,20), (x,y,width,height)]. Return List[ctypes.Array], a list whose elements are ctypes.Array which is an iterable array of int...
rects: List[Tuple[int, int, int, int]], such as [(0,0,10,10), (10,10,20,20), (x,y,width,height)]. Return List[ctypes.Array], a list whose elements are ctypes.Array which is an iterable array of int values in argb.
GetPixelColorsOfRects
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetSubBitmap(self, x: int, y: int, width: int, height: int) -> 'Bitmap': """ x: int. y: int. width: int. height: int. Return `Bitmap`, a sub bitmap of the input rect. """ colors = self.GetPixelColorsOfRect(x, y, width, height) bitmap = Bitmap(w...
x: int. y: int. width: int. height: int. Return `Bitmap`, a sub bitmap of the input rect.
GetSubBitmap
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetPatternIdInterface(patternId: int): """ Get pattern COM interface by pattern id. patternId: int, a value in class `PatternId`. Return comtypes._cominterface_meta. """ global _PatternIdInterfaces if not _PatternIdInterfaces: _PatternIdInterfaces = { # PatternId.Anno...
Get pattern COM interface by pattern id. patternId: int, a value in class `PatternId`. Return comtypes._cominterface_meta.
GetPatternIdInterface
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetDockPosition(self, dockPosition: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationDockPattern::SetDockPosition. dockPosition: int, a value in class `DockPosition`. waitTime: float. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautoma...
Call IUIAutomationDockPattern::SetDockPosition. dockPosition: int, a value in class `DockPosition`. waitTime: float. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdockpattern-setdockposition
SetDockPosition
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetGrabbedItems(self) -> List['Control']: """ Call IUIAutomationDragPattern::GetCurrentGrabbedItems. Return List[Control], a list of `Control` subclasses that represent the full set of items that the user is dragging as part of a drag operation. Refer https://doc...
Call IUIAutomationDragPattern::GetCurrentGrabbedItems. Return List[Control], a list of `Control` subclasses that represent the full set of items that the user is dragging as part of a drag operation. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationcli...
GetGrabbedItems
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Collapse(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationExpandCollapsePattern::Collapse. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationcl...
Call IUIAutomationExpandCollapsePattern::Collapse. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationexpandcollapsepattern-collapse
Collapse
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Expand(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationExpandCollapsePattern::Expand. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient...
Call IUIAutomationExpandCollapsePattern::Expand. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationexpandcollapsepattern-expand
Expand
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Invoke(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationInvokePattern::Invoke. Invoke the action of a control, such as a button click. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/wind...
Call IUIAutomationInvokePattern::Invoke. Invoke the action of a control, such as a button click. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationinvoke...
Invoke
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def DoDefaultAction(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationLegacyIAccessiblePattern::DoDefaultAction. Perform the Microsoft Active Accessibility default action for the element. waitTime: float. Return bool, True if succeed otherwise False. ...
Call IUIAutomationLegacyIAccessiblePattern::DoDefaultAction. Perform the Microsoft Active Accessibility default action for the element. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf...
DoDefaultAction
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def GetSelection(self) -> List['Control']: """ Call IUIAutomationLegacyIAccessiblePattern::GetCurrentSelection. Return List[Control], a list of `Control` subclasses, the Microsoft Active Accessibility property that identifies the selected children of this element. Re...
Call IUIAutomationLegacyIAccessiblePattern::GetCurrentSelection. Return List[Control], a list of `Control` subclasses, the Microsoft Active Accessibility property that identifies the selected children of this element. Refer https://docs.microsoft.com/en-us/windows/desktop/a...
GetSelection
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def Select(self, flagsSelect: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationLegacyIAccessiblePattern::Select. Perform a Microsoft Active Accessibility selection. flagsSelect: int, a value in `AccessibleSelection`. waitTime: float. Return bool,...
Call IUIAutomationLegacyIAccessiblePattern::Select. Perform a Microsoft Active Accessibility selection. flagsSelect: int, a value in `AccessibleSelection`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/deskt...
Select
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetValue(self, value: str, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationLegacyIAccessiblePattern::SetValue. Set the Microsoft Active Accessibility value property for the element. value: str. waitTime: float. Return bool, True if succeed otherw...
Call IUIAutomationLegacyIAccessiblePattern::SetValue. Set the Microsoft Active Accessibility value property for the element. value: str. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomation...
SetValue
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def SetValue(self, value: float, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationRangeValuePattern::SetValue. Set the value of the control. value: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsof...
Call IUIAutomationRangeValuePattern::SetValue. Set the value of the control. value: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangev...
SetValue
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0
def ScrollIntoView(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationScrollItemPattern::ScrollIntoView. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiauto...
Call IUIAutomationScrollItemPattern::ScrollIntoView. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollitempattern-scrollintoview
ScrollIntoView
python
cluic/wxauto
wxauto/uiautomation.py
https://github.com/cluic/wxauto/blob/master/wxauto/uiautomation.py
Apache-2.0