Skip to content

Commit 9703542

Browse files
committed
docs: Rename documentation directory from docs to website
1 parent bbea4fa commit 9703542

File tree

13 files changed

+18498
-7
lines changed

13 files changed

+18498
-7
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'docs/**'
8+
- 'website/**'
99
- '.github/workflows/deploy-docs.yml'
1010

1111
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
@@ -31,20 +31,20 @@ jobs:
3131
with:
3232
node-version: 24
3333
cache: npm
34-
cache-dependency-path: docs/package-lock.json
34+
cache-dependency-path: website/package-lock.json
3535

3636
- name: Install dependencies
37-
working-directory: docs
37+
working-directory: website
3838
run: npm ci
3939

4040
- name: Build website
41-
working-directory: docs
41+
working-directory: website
4242
run: npm run build
4343

4444
- name: Upload artifact
4545
uses: actions/upload-pages-artifact@v3
4646
with:
47-
path: docs/build
47+
path: website/build
4848

4949
deploy:
5050
name: Deploy to GitHub Pages

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ instance/
6868
# Scrapy stuff:
6969
.scrapy
7070

71-
# Sphinx documentation
72-
docs/_build/
71+
# Website (Docusaurus)
72+
website/build/
73+
website/.docusaurus/
74+
website/.cache-loader/
7375

7476
# PyBuilder
7577
target/

website/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

website/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```bash
8+
yarn
9+
```
10+
11+
## Local Development
12+
13+
```bash
14+
yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```bash
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
Using SSH:
30+
31+
```bash
32+
USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```bash
38+
GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

website/docs/api.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# API Reference
6+
7+
## `Tk` Class
8+
9+
The `Tk` class is a drop-in replacement for `tkinter.Tk` with DPI awareness capabilities.
10+
11+
```python
12+
from tkinter_unblur import Tk
13+
```
14+
15+
### Attributes
16+
17+
| Attribute | Type | Description |
18+
|-----------|------|-------------|
19+
| `dpi_x` | `int` \| `None` | Horizontal DPI (96 = 100% scaling). `None` on non-Windows platforms. |
20+
| `dpi_y` | `int` \| `None` | Vertical DPI (96 = 100% scaling). `None` on non-Windows platforms. |
21+
| `dpi_scaling` | `float` | Scaling factor (1.0 = 100%, 1.5 = 150%, etc.). |
22+
23+
**Example:**
24+
25+
```python
26+
root = Tk()
27+
print(f"DPI: {root.dpi_x}x{root.dpi_y}")
28+
print(f"Scaling: {root.dpi_scaling:.0%}")
29+
# Output: Scaling: 150%
30+
```
31+
32+
### Methods
33+
34+
#### `scale_value`
35+
36+
Scale a numeric value according to the current DPI scaling factor.
37+
38+
```python
39+
def scale_value(self, value: float | str) -> int
40+
```
41+
42+
**Arguments:**
43+
- `value`: The value to scale (can be int, float, or numeric string).
44+
45+
**Returns:**
46+
- The scaled value as an integer.
47+
48+
**Example:**
49+
50+
```python
51+
from tkinter import Label
52+
53+
root = Tk()
54+
# Scale font size to maintain physical size across different DPI settings
55+
label = Label(root, text="Hello", font=("Arial", root.scale_value(12)))
56+
```
57+
58+
#### `scale_geometry`
59+
60+
Scale a geometry string according to the current DPI scaling factor.
61+
62+
```python
63+
def scale_geometry(self, geometry: str) -> str
64+
```
65+
66+
**Arguments:**
67+
- `geometry`: A Tkinter geometry string in format `"WxH+X+Y"`.
68+
69+
**Returns:**
70+
- The scaled geometry string.
71+
72+
**Example:**
73+
74+
```python
75+
root = Tk()
76+
# Scale window geometry (width x height + x + y)
77+
root.geometry(root.scale_geometry("800x600+100+50"))
78+
```
79+
80+
## Exceptions
81+
82+
The library defines the following exceptions in `tkinter_unblur.exceptions`:
83+
84+
### `TkinterUnblurError`
85+
Base exception for all errors raised by this library.
86+
87+
### `UnsupportedPlatformError`
88+
Raised when attempting to use Windows-specific features on a non-Windows platform (though the main `Tk` class handles this gracefully by disabling DPI features).
89+
90+
### `DPIDetectionError`
91+
Raised when DPI detection fails on Windows.

website/docs/index.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Introduction
6+
7+
**Fix blurry Tkinter applications on Windows 10/11 high-DPI displays.**
8+
9+
tkinter-unblur provides a drop-in replacement for `tkinter.Tk` that automatically applies DPI awareness on Windows 10/11, fixing the common "blurry text" problem.
10+
11+
## The Problem
12+
13+
Tkinter applications look blurry and pixelated on modern high-resolution displays with scaling enabled (125%, 150%, 200%, etc.). This is because Tkinter is not DPI-aware by default on Windows.
14+
15+
## The Solution
16+
17+
```python
18+
# Before (blurry)
19+
from tkinter import Tk
20+
21+
# After (crystal clear)
22+
from tkinter_unblur import Tk
23+
```
24+
25+
That's it. One import change, and your Tkinter app renders sharply.
26+
27+
## Installation
28+
29+
```bash
30+
pip install tkinter-unblur
31+
```
32+
33+
## Usage
34+
35+
```python
36+
from tkinter_unblur import Tk
37+
38+
root = Tk()
39+
root.title("My App")
40+
root.geometry("800x600")
41+
root.mainloop()
42+
```
43+
44+
That's all you need! For advanced usage, see the [API Reference](./api).
45+
46+
## Compatibility
47+
48+
| Platform | Status |
49+
|----------|--------|
50+
| Windows 10/11 | Full DPI awareness support |
51+
| Linux | Passthrough (OS handles DPI) |
52+
| macOS | Passthrough (OS handles DPI) |
53+
54+
| Python Version | Status |
55+
|----------------|--------|
56+
| 3.9 - 3.14 | Supported |
57+
| 3.8 | Not supported (EOL) |
58+
59+
## Migrating from hdpitkinter
60+
61+
This package was formerly known as `hdpitkinter`. To migrate:
62+
63+
```bash
64+
pip uninstall hdpitkinter
65+
pip install tkinter-unblur
66+
```
67+
68+
```python
69+
# Old
70+
from hdpitkinter import HdpiTk
71+
root = HdpiTk()
72+
73+
# New
74+
from tkinter_unblur import Tk
75+
root = Tk()
76+
```
77+
78+
The `HdpiTk` name is still available as an alias for backwards compatibility:
79+
80+
```python
81+
from tkinter_unblur import HdpiTk # Works, but Tk is preferred
82+
```

0 commit comments

Comments
 (0)