-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
144 lines (93 loc) · 2.61 KB
/
main.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# 79.170.167.30
# HOST = '79.170.167.30'
# PORT = 58596
# test-client.py
import multiprocessing
import socket
import sys
# sockets
'''import time
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('79.170.167.30', 58596)
print('Подключено к {} порт {}'.format(*server_address))
sock.connect(server_address)
try:
mess = 'Hello Wоrld!'
print(f'Отправка: {mess}')
message = mess.encode()
sock.sendall(message)
amount_received = 0
amount_expected = len(message)
while amount_received < amount_expected:
data = sock.recv(16)
amount_received += len(data)
mess = data.decode()
print(f'Получено: {data.decode()}')
finally:
print('Закрываем сокет')
sock.close()'''
import kivymd
from kivymd.app import MDApp
from kivymd.uix.screen import Screen
from kivy.uix.scrollview import ScrollView
from kivymd.uix.list import MDList, OneLineListItem
class MyApp(MDApp):
def build(self):
screen = Screen()
scroll = ScrollView()
list_view = MDList()
scroll.add_widget(list_view)
for i in range(20):
items = OneLineListItem(text='Item '+str(i))
list_view.add_widget(items)
screen.add_widget(scroll)
return screen
if __name__ == '__main__':
MyApp().run()
'''import os
import multiprocessing as mp
from multiprocessing import Process
def c(tet,x):
with open(tet, 'a') as n:
n.write(x+" - "+multiprocessing.current_process().name+"\n")
def f(x):
f.q.put('Doing: ' + str(x))
print( multiprocessing.current_process().name+"\n")
tet = multiprocessing.current_process().name +".txt"
c(tet=tet, x=x)
return x
def f_init(q):
f.q = q
def func(jobs,q):
time.sleep(20)
for i in range(len(jobs)):
print(q.qsize())
print(q.get())
time.sleep(5)
def main():
jobs = ["polo","solo","olo","polo1","solo1","olo1"]
q = mp.Queue()
p = mp.Pool(3, f_init, [q])
proc = Process(target=func, args=(jobs,q))
proc.start()
p.imap(f, jobs)
p.close()
while True:
x = input("Узнать сколько в очереди: ")
if x == 'q':
print(q.qsize())
if __name__ == '__main__':
main()
'''
'''import multiprocessing
def calc_square(numbers, q):
for n in numbers:
q.put(n*n)
if __name__ == "__main__":
numbers = [2,3,5]
q = multiprocessing.Queue()
p = multiprocessing.Process(target=calc_square, args=(numbers,q))
p.start()
p.join()
while q.empty() is False:
print(q.get())'''