win32more


Namewin32more JSON
Version 0.5.7 PyPI version JSON
download
home_pageNone
SummaryPython bindings for Windows API
upload_time2024-12-01 13:11:56
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Win32more

[![PyPI - Version](https://img.shields.io/pypi/v/win32more.svg)](https://pypi.org/project/win32more)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/win32more.svg)](https://pypi.org/project/win32more)

Win32more is a python bindings for Windows API generated from metadata.

https://github.com/microsoft/win32metadata

https://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts

https://github.com/microsoft/WindowsAppSDK

## Description

This Python module provides a comprehensive interface for interacting with the Win32 API, allowing you to perform a wide range of operations and access system functionalities within the Windows environment. The `win32more` library facilitates interaction with Windows system components and applications through direct API calls, making it an invaluable tool for developers needing to interface with Windows at a low level.

`win32more` is a powerful replacement for older libraries and provides enhanced support for modern Windows versions and APIs. With this module, you can leverage the full capabilities of the Win32 API to create, manage, and manipulate system resources and applications with ease.

Whether you're building utilities, automating tasks, or developing advanced applications, `win32more` offers the flexibility and control you need.

![Win32more Example Screenshot](./README-example-usage-img.jpg)

### Example Usage of Win32more
```python
# winui.py
from win32more.xaml import XamlApplication
from win32more.Microsoft.UI.Xaml import Window
from win32more.Microsoft.UI.Xaml.Media import MicaBackdrop
from win32more.Microsoft.UI.Xaml.Markup import XamlReader

class App(XamlApplication):
    def OnLaunched(self, args):
        win = Window()
        win.SystemBackdrop = MicaBackdrop()
        with open("page.xaml", "r", encoding='utf-8') as file:
            win.Content = XamlReader.Load(file.read())
        win.Activate()

XamlApplication.Start(App)
```

```xml
<!-- page.xaml -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <NavigationView IsBackButtonVisible="Collapsed">
        <NavigationView.MenuItems>
            <NavigationViewItem Content="Home" Icon="Home" />
        </NavigationView.MenuItems>
        <Frame>
            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock Text="WinUI 3 with Python!" FontSize="40" Padding="10" HorizontalAlignment="Center" />
                <HyperlinkButton Content="GitHub repository" NavigateUri="https://github.com/ynkdir/py-win32more" HorizontalAlignment="Center" />
            </StackPanel>
        </Frame>
    </NavigationView>
</Page>
```

NOTE: This library requires a compatible Windows environment and appropriate permissions to access certain system functions.

## Installation

```bash
# Install Win32more Library
python -m pip install win32more
```

## Programming with Win32more

Let's build a simple app with `Win32more`. To begin, create an empty window and display it on the screen.
```python
from win32more.Microsoft.UI.Xaml import Window
from win32more.xaml import XamlApplication

class App(XamlApplication):
    def OnLaunched(self, args):
        win = Window()
        
        win.Activate()

XamlApplication.Start(App)
```

### Adding elements to the window

Now, add some elements to the window (don't forget to import them at the beginning of the script). To navigate into WinUI views and know from which library you've to import yours, take a look at the **WinUI 3 Gallery** app, avaible on Microsoft Store.

For example, the **Button** view belongs to `Microsoft.UI.Xaml.Controls`. Then import it as follows :
```python
from win32more.Microsoft.UI.Xaml import Window
from win32more.Microsoft.UI.Xaml.Controls import Button # Import Button view
from win32more.xaml import XamlApplication

class App(XamlApplication):
    def OnLaunched(self, args):
        win = Window()
        
        btn = Button() # Init Button instance
        btn.Content = "Hello World" # Set Button content
        
        win.Content = btn # Put it into the window
        win.Activate()

XamlApplication.Start(App)
```

### Handle (Button click) events

You'll probably want to run some code when you click on your button. Create a `ButtonClick` method to print "Hello World" in the console and link it to your button.
```python
from win32more.Microsoft.UI.Xaml import Window
from win32more.Microsoft.UI.Xaml.Controls import Button
from win32more.xaml import XamlApplication

class App(XamlApplication):
    def OnLaunched(self, args):
        win = Window()
        
        btn = Button()
        btn.Content = "Hello World"
        btn.add_Click(self.ButtonClick) # Link Button to method
        
        win.Content = btn
        win.Activate()
    
    def ButtonClick(self, sender, args): # Create method
        print("Hello World")

XamlApplication.Start(App)
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "win32more",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/42/6b/59fd6b6ebfbe38d0139636600160178f2430099eadc447f998d481fd9331/win32more-0.5.7.tar.gz",
    "platform": null,
    "description": "# Win32more\n\n[![PyPI - Version](https://img.shields.io/pypi/v/win32more.svg)](https://pypi.org/project/win32more)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/win32more.svg)](https://pypi.org/project/win32more)\n\nWin32more is a python bindings for Windows API generated from metadata.\n\nhttps://github.com/microsoft/win32metadata\n\nhttps://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts\n\nhttps://github.com/microsoft/WindowsAppSDK\n\n## Description\n\nThis Python module provides a comprehensive interface for interacting with the Win32 API, allowing you to perform a wide range of operations and access system functionalities within the Windows environment. The `win32more` library facilitates interaction with Windows system components and applications through direct API calls, making it an invaluable tool for developers needing to interface with Windows at a low level.\n\n`win32more` is a powerful replacement for older libraries and provides enhanced support for modern Windows versions and APIs. With this module, you can leverage the full capabilities of the Win32 API to create, manage, and manipulate system resources and applications with ease.\n\nWhether you're building utilities, automating tasks, or developing advanced applications, `win32more` offers the flexibility and control you need.\n\n![Win32more Example Screenshot](./README-example-usage-img.jpg)\n\n### Example Usage of Win32more\n```python\n# winui.py\nfrom win32more.xaml import XamlApplication\nfrom win32more.Microsoft.UI.Xaml import Window\nfrom win32more.Microsoft.UI.Xaml.Media import MicaBackdrop\nfrom win32more.Microsoft.UI.Xaml.Markup import XamlReader\n\nclass App(XamlApplication):\n    def OnLaunched(self, args):\n        win = Window()\n        win.SystemBackdrop = MicaBackdrop()\n        with open(\"page.xaml\", \"r\", encoding='utf-8') as file:\n            win.Content = XamlReader.Load(file.read())\n        win.Activate()\n\nXamlApplication.Start(App)\n```\n\n```xml\n<!-- page.xaml -->\n<Page xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">\n    <NavigationView IsBackButtonVisible=\"Collapsed\">\n        <NavigationView.MenuItems>\n            <NavigationViewItem Content=\"Home\" Icon=\"Home\" />\n        </NavigationView.MenuItems>\n        <Frame>\n            <StackPanel HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\">\n                <TextBlock Text=\"WinUI 3 with Python!\" FontSize=\"40\" Padding=\"10\" HorizontalAlignment=\"Center\" />\n                <HyperlinkButton Content=\"GitHub repository\" NavigateUri=\"https://github.com/ynkdir/py-win32more\" HorizontalAlignment=\"Center\" />\n            </StackPanel>\n        </Frame>\n    </NavigationView>\n</Page>\n```\n\nNOTE: This library requires a compatible Windows environment and appropriate permissions to access certain system functions.\n\n## Installation\n\n```bash\n# Install Win32more Library\npython -m pip install win32more\n```\n\n## Programming with Win32more\n\nLet's build a simple app with `Win32more`. To begin, create an empty window and display it on the screen.\n```python\nfrom win32more.Microsoft.UI.Xaml import Window\nfrom win32more.xaml import XamlApplication\n\nclass App(XamlApplication):\n    def OnLaunched(self, args):\n        win = Window()\n        \n        win.Activate()\n\nXamlApplication.Start(App)\n```\n\n### Adding elements to the window\n\nNow, add some elements to the window (don't forget to import them at the beginning of the script). To navigate into WinUI views and know from which library you've to import yours, take a look at the **WinUI 3 Gallery** app, avaible on Microsoft Store.\n\nFor example, the **Button** view belongs to `Microsoft.UI.Xaml.Controls`. Then import it as follows :\n```python\nfrom win32more.Microsoft.UI.Xaml import Window\nfrom win32more.Microsoft.UI.Xaml.Controls import Button # Import Button view\nfrom win32more.xaml import XamlApplication\n\nclass App(XamlApplication):\n    def OnLaunched(self, args):\n        win = Window()\n        \n        btn = Button() # Init Button instance\n        btn.Content = \"Hello World\" # Set Button content\n        \n        win.Content = btn # Put it into the window\n        win.Activate()\n\nXamlApplication.Start(App)\n```\n\n### Handle (Button click) events\n\nYou'll probably want to run some code when you click on your button. Create a `ButtonClick` method to print \"Hello World\" in the console and link it to your button.\n```python\nfrom win32more.Microsoft.UI.Xaml import Window\nfrom win32more.Microsoft.UI.Xaml.Controls import Button\nfrom win32more.xaml import XamlApplication\n\nclass App(XamlApplication):\n    def OnLaunched(self, args):\n        win = Window()\n        \n        btn = Button()\n        btn.Content = \"Hello World\"\n        btn.add_Click(self.ButtonClick) # Link Button to method\n        \n        win.Content = btn\n        win.Activate()\n    \n    def ButtonClick(self, sender, args): # Create method\n        print(\"Hello World\")\n\nXamlApplication.Start(App)\n```",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python bindings for Windows API",
    "version": "0.5.7",
    "project_urls": {
        "Homepage": "https://github.com/ynkdir/py-win32more"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6a6ec90901700ebb925aa62daa5342657bd837337ea011bb7620cf47f73db6c0",
                "md5": "0e699a1fc4b4813965cc443b403342fe",
                "sha256": "fdc0aec1cd9b01f8fdb322a534405552c59a246db638e29cebaf795db6693504"
            },
            "downloads": -1,
            "filename": "win32more-0.5.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e699a1fc4b4813965cc443b403342fe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7791873,
            "upload_time": "2024-12-01T13:11:48",
            "upload_time_iso_8601": "2024-12-01T13:11:48.624576Z",
            "url": "https://files.pythonhosted.org/packages/6a/6e/c90901700ebb925aa62daa5342657bd837337ea011bb7620cf47f73db6c0/win32more-0.5.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "426b59fd6b6ebfbe38d0139636600160178f2430099eadc447f998d481fd9331",
                "md5": "f6be70e6022dfe17995d8f0b1a0394fc",
                "sha256": "805eb2cd8f86760b471efcebb624e997832c8bbf13f236543391c396ac0caa2b"
            },
            "downloads": -1,
            "filename": "win32more-0.5.7.tar.gz",
            "has_sig": false,
            "md5_digest": "f6be70e6022dfe17995d8f0b1a0394fc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7231799,
            "upload_time": "2024-12-01T13:11:56",
            "upload_time_iso_8601": "2024-12-01T13:11:56.344259Z",
            "url": "https://files.pythonhosted.org/packages/42/6b/59fd6b6ebfbe38d0139636600160178f2430099eadc447f998d481fd9331/win32more-0.5.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-01 13:11:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ynkdir",
    "github_project": "py-win32more",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "win32more"
}
        
Elapsed time: 0.37662s