import multiprocessing
import time
def func(number):
for i in range(1, 10):
time.sleep(0.01)
print('Processing ' + str(number) + ': prints ' + str(number*i))
# list of all processes, so that they can be killed afterwards
all_processes = []
for i in range(0, 3):
process = multiprocessing.Process(target=func, args=(i,))
process.start()
all_processes.append(process)
# kill all processes after 0.03s
time.sleep(0.03)
for process in all_processes:
process.terminate()
from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.config import Config
from random import choice
Config.set('graphics', 'resizable', '1')
Config.set('graphics', 'width', '350')
Config.set('graphics', 'height', '150')
class PassGenApp(App):
txt1 = TextInput()
txt2 = TextInput()
chars = '+-/*!&$#?=@<>%^:;""_~()abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
def generate(self):
print(["".join([choice(self.chars) for i in range(int(self.txt2.text))]) for passcount in range(int(self.txt1.text))])
def build(self, **kwargs):
bl = BoxLayout(orientation='vertical')
gl = GridLayout(cols=2)
bl.add_widget(Label(text=''))
gl.add_widget(Label(text='PassNum:'))
gl.add_widget(self.txt1)
gl.add_widget(Label(text='PassLength:'))
gl.add_widget(self.txt2)
gl.add_widget(Button(text='Generate'))
gl.add_widget(bl)
return gl
if __name__ =='__main__':
PassGenApp().run()
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
python3 не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
pyinstaller --onefile --add-data "logo.jpg;logo.jpg" main.py
pyinstaller --onefile --add-data "imgs\logo.jpg;imgs\logo.jpg" main.py
>>> from requests import Response
>>> help(Response)
Help on class Response in module requests.models:
class Response(builtins.object)
| The :class:`Response <Response>` object, which contains a
| server's response to an HTTP request.
|
| Methods defined here:
|
| __bool__(self)
| Returns True if :attr:`status_code` is less than 400.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code, is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __getstate__(self)
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self)
| Allows you to use a response as an iterator.
|
| __nonzero__(self)
-- Далее --
def browse_file(qlineedit_tab):
file = QtWidgets.QFileDialog.getOpenFileName(self)
qlineedit_tab.setText(file[0])
def formatter(s):
return s.replace("\\n", "\n").replace("\\t", "\t")# and etc.
description=".clear - **Clear messages**\n.info - **info about server**")