forked from Skelett/is12-programmeerimise_algkursus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkursor.py
61 lines (43 loc) · 1.07 KB
/
kursor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
#-*- coding: utf8 -*-
import sys
import time
#ette anda kursuri alguspunkt x ja y ja just sinna prindib ette antud teksti
"""
print "\033[y;xH" - viib kursori koordinaatidele x ja y
print "\033[2J" - ekraan tühjaks
"""
"""
def kursor(x, y, t):
sys.stdout.write( "\033["+ str(y) + ";" + str(x) + "H" + t)
kursor(10, 20, "kollane")
sys.stdout.flush()
time.sleep(60)
"""
"""
ül
kasutades eelmises funktsioonis loodus kursori peoitsioneerimise ja teksti väljastamise
funktsiooni---
Loo uus funktsioon, mis väljastab ekraanile kasti servad. Funktsiooni parameetrid: x, y, w, h
"""
def kursor(x, y, t):
sys.stdout.write( "\033["+ str(y) + ";" + str(x) + "H" + t)
def box(x, y, w, h):
kursor(x, y, "#"*x)
kursor(x+w, y, "#")
kursor(y, h, "#")
kursor(x+w, w, "#")
kursor(x, w, "#"*x)
kursor(x+w, h, "#")
box(15, 20, 15, 20)
sys.stdout.flush()
time.sleep(60)
"""
def kursor(x, y, t):
sys.stdout.write( "\033["+ str(y) + ";" + str(x) + "H" + t)
def box(x, y, w, h):
kursor(x, y, "#"*x)
box(15, 20, 70, 20)
sys.stdout.flush()
time.sleep(60)
"""