Skip to content

Instantly share code, notes, and snippets.

@rupython
rupython / config.py
Created March 4, 2019 17:34
From: Сергей
import colors
screen_width = 800
screen_height = 600
background_image = 'images/background.jpg'
frame_rate = 90
row_count = 6
brick_width = 60
@rupython
rupython / game.py
Created March 4, 2019 17:34
From: Сергей
import pygame
import sys
from collections import defaultdict
class Game:
def __init__(self, caption, width, height, back_image_filename, frame_rate):
self.background_image = pygame.image.load(back_image_filename)
self.frame_rate = frame_rate
@rupython
rupython / game_object.py
Created March 4, 2019 17:34
From: Сергей
from pygame.rect import Rect
class GameObject:
def __init__(self, x, y, w, h, speed=(0,0)):
self.bounds = Rect(x, y, w, h)
self.speed = speed
@property
def left(self):
@rupython
rupython / paddle.py
Created March 4, 2019 17:34
From: Сергей
import pygame
import config as c
from game_object import GameObject
class Paddle(GameObject):
def __init__(self, x, y, w, h, color, offset):
GameObject.__init__(self, x, y, w, h)
self.color = color
@rupython
rupython / text_object.py
Created March 4, 2019 17:34
From: Сергей
import pygame
class TextObject:
def __init__(self, x, y, text_func, color, font_name, font_size):
self.pos = (x, y)
self.text_func = text_func
self.color = color
self.font = pygame.font.SysFont(font_name, font_size)
self.bounds = self.get_surface(text_func())
@rupython
rupython / main.py
Created March 6, 2019 08:30
From: Guzelia
#inputting the information
news_header = input("Введите название для новости: ")
news_text = input("Введите текст новости: ")
news_header = news_header.upper()
text_in_quotes = '"%s"' % news_header
number_of_symbols = len(news_text)
#Outputting the information
print(current_date.rjust(50))
@rupython
rupython / ls_news.py
Created March 6, 2019 14:42
From: Makaryants
def ls_news(message):
if message.text == "Новости":
bot.send_message(message.chat.id, 'Тут будут отображаться новости LoudSound', reply_markup=keyboard)
@rupython
rupython / main.py
Created March 6, 2019 14:42
From: Makaryants
import telebot
from telebot import types
import config
from ls_news import *
bot = telebot.TeleBot(config.token)
@bot.message_handler(commands=['start'])
def start(message):
sent = bot.send_message(message.chat.id, 'Добро пожаловать в самый громкий магазин России - LoudSound\n\nНапишите мне что-нибудь')
@rupython
rupython / main.py
Created March 8, 2019 12:36
From: Alexey
try:
##var
config.plugins.NewYear.delay
except NameError:
#var_exists = False
config.plugins.NewYear.delay.value_exists = False
weather_city = 1123200
open('/media/hdd/ClockToText_log.txt', 'a').write(str(weather_city)+'\n')
else:
#var_exists = True
@rupython
rupython / power_sys.txt
Created March 8, 2019 15:42
From: Сергей
import tkinter as tk
class Sys(tk.Tk, object):
def __init__(self):
super(Sys, self).__init__()
self.action_space = ['up_power1', 'down_power1', 'up_power2', 'down_power2']
self.n_actions = len(self.action_space)
self.n_features = 2
self.title('SYSTEM')
self.geometry('{0}x{1}'.format(500, 500)) # dimentions