FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
curtsies/examples/initial_input_with_cursor.py at main · bpython/curtsies · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
bpython
/
curtsies
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
51
Star
231
Code
Issues
36
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
curtsies
/
examples
/
initial_input_with_cursor.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (18 loc) · 646 Bytes
Breadcrumbs
curtsies
/
examples
/
initial_input_with_cursor.py
Copy path
File metadata and controls
21 lines (18 loc) · 646 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import
time
from
curtsies
import
*
def
main
():
"""Ideally we shouldn't lose the first second of events"""
with
Input
()
as
input_generator
:
def
extra_bytes_callback
(
string
):
print
(
'got extra bytes'
,
repr
(
string
))
print
(
'type:'
,
type
(
string
))
input_generator
.
unget_bytes
(
string
)
time
.
sleep
(
1
)
with
CursorAwareWindow
(
extra_bytes_callback
=
extra_bytes_callback
)
as
window
:
window
.
get_cursor_position
()
for
e
in
input_generator
:
print
(
repr
(
e
))
if
e
==
'<ESC>'
:
break
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL