typeglide 0.3.1__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: typeglide
3
+ Version: 0.3.3
4
+ Summary: A smooth typewriter text effect library for Python. Works with tkinter too! Made by dakshu.
5
+ Author-email: Dakshu <dakshumail98@gmail.com>
6
+ License-File: LICENSE
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.11.14
11
+ Description-Content-Type: text/markdown
12
+
13
+ # typeglide
14
+
15
+ A smooth typewriter text effect library for Python — made by dakshu.
16
+
17
+ ## Installation
18
+ ```bash
19
+ pip install typeglide
20
+ ```
21
+
22
+ ## How to use it?
23
+
24
+ ### Simple code to use:
25
+
26
+ ```python
27
+ import typeglide
28
+
29
+ glide = typeglide.save("Hello World", delay=0.05) # Save The Text
30
+ print(glide) # Print The Animated text
31
+ ```
32
+
33
+ ### This now works with tkinter 🐱
34
+
35
+ ```python
36
+ import typeglide
37
+ import tkinter as tk
38
+
39
+ glide = typeglide.save("Hello World", delay=0.05)
40
+
41
+ def do():
42
+ glide.animate_widget(label)
43
+
44
+ root = tk.Tk()
45
+ label = tk.Label(text="hi")
46
+ label.pack()
47
+ button = tk.Button(text="press", command=do)
48
+ button.pack()
49
+ root.mainloop()
50
+ ```
@@ -0,0 +1,38 @@
1
+ # typeglide
2
+
3
+ A smooth typewriter text effect library for Python — made by dakshu.
4
+
5
+ ## Installation
6
+ ```bash
7
+ pip install typeglide
8
+ ```
9
+
10
+ ## How to use it?
11
+
12
+ ### Simple code to use:
13
+
14
+ ```python
15
+ import typeglide
16
+
17
+ glide = typeglide.save("Hello World", delay=0.05) # Save The Text
18
+ print(glide) # Print The Animated text
19
+ ```
20
+
21
+ ### This now works with tkinter 🐱
22
+
23
+ ```python
24
+ import typeglide
25
+ import tkinter as tk
26
+
27
+ glide = typeglide.save("Hello World", delay=0.05)
28
+
29
+ def do():
30
+ glide.animate_widget(label)
31
+
32
+ root = tk.Tk()
33
+ label = tk.Label(text="hi")
34
+ label.pack()
35
+ button = tk.Button(text="press", command=do)
36
+ button.pack()
37
+ root.mainloop()
38
+ ```
@@ -4,8 +4,8 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "typeglide"
7
- version = "0.3.1"
8
- description = "A smooth typewriter printing library that is made by dakshu."
7
+ version = "0.3.3"
8
+ description = "A smooth typewriter text effect library for Python. Works with tkinter too! Made by dakshu."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11.14"
11
11
  authors = [
@@ -0,0 +1,3 @@
1
+ from .engine import write, save, Glide
2
+
3
+ __version__ = "0.3.3"
@@ -0,0 +1,83 @@
1
+ import sys
2
+ import time
3
+
4
+
5
+ def write(text, delay=0.05, end="\n"):
6
+ """
7
+ Prints text to the console character by character.
8
+
9
+ :param text: The string to print.
10
+ :param delay: Time in seconds between each character.
11
+ :param end: The character to print at the very end (defaults to newline).
12
+ """
13
+ for char in text:
14
+ sys.stdout.write(char)
15
+ sys.stdout.flush()
16
+ time.sleep(delay)
17
+ sys.stdout.write(end)
18
+ sys.stdout.flush()
19
+
20
+
21
+ class Glide:
22
+ """
23
+ A saveable typewriter-effect object.
24
+
25
+ Usage:
26
+ glide = typeglide.save("Hello", delay=0.05)
27
+
28
+ # Terminal — animates character by character:
29
+ print(glide)
30
+
31
+ # Tkinter static text:
32
+ button.config(text=glide.text)
33
+
34
+ # Tkinter animated text:
35
+ glide.animate_widget(button)
36
+ """
37
+
38
+ def __init__(self, text, delay=0.05, end="\n"):
39
+ self.text = text
40
+ self.delay = delay
41
+ self.end = end
42
+
43
+ def __str__(self):
44
+ for char in self.text:
45
+ sys.stdout.write(char)
46
+ sys.stdout.flush()
47
+ time.sleep(self.delay)
48
+ return ""
49
+
50
+ def __repr__(self):
51
+ return f"Glide({self.text!r}, delay={self.delay})"
52
+
53
+ def animate_widget(self, widget, attr="text"):
54
+ """
55
+ Animate the text into a tkinter widget one character at a time.
56
+
57
+ :param widget: Any tkinter widget that supports .config().
58
+ :param attr: The config attribute to update (default 'text').
59
+
60
+ Example:
61
+ glide.animate_widget(button)
62
+ glide.animate_widget(label)
63
+ """
64
+ delay_ms = int(self.delay * 1000)
65
+
66
+ def _step(index):
67
+ widget.config(**{attr: self.text[:index]})
68
+ if index < len(self.text):
69
+ widget.after(delay_ms, _step, index + 1)
70
+
71
+ _step(0)
72
+
73
+
74
+ def save(text, delay=0.05, end="\n"):
75
+ """
76
+ Save a typewriter-effect string for later use.
77
+
78
+ :param text: The string to animate.
79
+ :param delay: Time in seconds between each character.
80
+ :param end: End character used when printing (defaults to newline).
81
+ :returns: A Glide object.
82
+ """
83
+ return Glide(text, delay=delay, end=end)
typeglide-0.3.1/PKG-INFO DELETED
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: typeglide
3
- Version: 0.3.1
4
- Summary: A smooth typewriter printing library that is made by dakshu.
5
- Author-email: Dakshu <dakshumail98@gmail.com>
6
- License-File: LICENSE
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Operating System :: OS Independent
9
- Classifier: Programming Language :: Python :: 3
10
- Requires-Python: >=3.11.14
11
- Description-Content-Type: text/markdown
12
-
13
- # pytypewriter
14
-
15
- A simple Python library to create classic arcade/typewriter text effects in the terminal.
16
-
17
- ## Installation
18
- ```bash
19
- pip install pytypewriter-yourusername
typeglide-0.3.1/README.md DELETED
@@ -1,7 +0,0 @@
1
- # pytypewriter
2
-
3
- A simple Python library to create classic arcade/typewriter text effects in the terminal.
4
-
5
- ## Installation
6
- ```bash
7
- pip install pytypewriter-yourusername
@@ -1,3 +0,0 @@
1
- from .engine import write
2
-
3
- __version__ = "0.3.1"
@@ -1,18 +0,0 @@
1
- import sys
2
- import time
3
-
4
- def write(text, delay=0.05, end="\n"):
5
- """
6
- Prints text to the console character by character.
7
-
8
- :param text: The string to print.
9
- :param delay: Time in seconds between each character.
10
- :param end: The character to print at the very end (defaults to newline).
11
- """
12
- for char in text:
13
- sys.stdout.write(char)
14
- sys.stdout.flush()
15
- time.sleep(delay)
16
- sys.stdout.write(end)
17
- sys.stdout.flush()
18
-
File without changes