def draw_keyboard(ctx, keys): base_color = (.06,.06,.06) def b(ltr, width=60,height=100): return lambda: draw_key(ctx, round_shape, pick_color(base_color,ltr,keys), pick_letter(ltr), pick_lettercolor(ltr,keys), pick_bold(ltr,keys), width, height) def t(ltr, width=60,height=100): return lambda: draw_key(ctx, rect_shape, pick_color(base_color,ltr,keys), pick_letter(ltr), pick_lettercolor(ltr,keys), pick_bold(ltr,keys), width, height) #ugh, i have to manually position it. # :( :( :( x=60 + 20 r=4*x + 80 + 20 l = 100 + 10 v = l*2 for pos, key in { (0*x,0): b("S-", height=210), (1*x,0): t("T-"), (2*x,0): t("P-"), (3*x,0): t("H"), (4*x,0): b("*",width=80,height=210), (r+0*x,0): t("F"), (r+1*x,0): t("-P"), (r+2*x,0): t("L"), (r+3*x,0): t("-T"), (r+4*x,0): t("D"), # Bottom (x*1,l): b("K"), (x*2,l): b("W"), (x*3,l): b("R-"), (x*0+r,l): b("-R"), (x*1+r,l): b("B"), (x*2+r,l): b("G"), (x*3+r,l): b("-S"), (x*4+r,l): b("Z"), # Vowels (x*2+30, v): b("A"), (x*3+20, v): b("O"), (x*5-00, v): b("E"), (x*6-10, v): b("U"), }.items(): ctx.save() ctx.translate(*pos) key() ctx.restore()
def draw_keyboard(ctx, keys): base_color = (.06, .06, .06) def b(ltr, width=60, height=100): return lambda: draw_key(ctx, round_shape, pick_color(base_color, ltr, keys), pick_letter(ltr), pick_lettercolor(ltr, keys), pick_bold(ltr, keys), width, height) def t(ltr, width=60, height=100): return lambda: draw_key(ctx, rect_shape, pick_color(base_color, ltr, keys), pick_letter(ltr), pick_lettercolor(ltr, keys), pick_bold(ltr, keys), width, height) #ugh, i have to manually position it. # :( :( :( x = 60 + 20 r = 4 * x + 80 + 20 l = 100 + 10 v = l * 2 for pos, key in { (0 * x, 0): b("S-", height=210), (1 * x, 0): t("T-"), (2 * x, 0): t("P-"), (3 * x, 0): t("H"), (4 * x, 0): b("*", width=80, height=210), (r + 0 * x, 0): t("F"), (r + 1 * x, 0): t("-P"), (r + 2 * x, 0): t("L"), (r + 3 * x, 0): t("-T"), (r + 4 * x, 0): t("D"), # Bottom (x * 1, l): b("K"), (x * 2, l): b("W"), (x * 3, l): b("R-"), (x * 0 + r, l): b("-R"), (x * 1 + r, l): b("B"), (x * 2 + r, l): b("G"), (x * 3 + r, l): b("-S"), (x * 4 + r, l): b("Z"), # Vowels (x * 2 + 30, v): b("A"), (x * 3 + 20, v): b("O"), (x * 5 - 00, v): b("E"), (x * 6 - 10, v): b("U"), }.items(): ctx.save() ctx.translate(*pos) key() ctx.restore()
def __init__(self,Key,text): self.Key=Key self.Text=text self.object1=key(self.Key) for i in range(len(self.Text)): self.Text_bin=self.Text_bin+self.object.hex2binarary(self.Text[i])
def init(f): #############IMPORTANT############ global is_test_mode is_test_mode = False ################################# global source source = "binance" global client client = key().getClient() global flags flags = f #URL declaration global kline_endpoint global trade_endpoint global trade_test_endpoint global price_ticker_endpoint global param_symbol_tag global param_interval_tag global param_limit_tag base_endpoint = 'https://api.binance.com' kline_endpoint = base_endpoint + '/api/v1/klines?' trade_endpoint = base_endpoint + '/api/v3/order?' trade_test_endpoint = base_endpoint + '/api/v3/order/test?' price_ticker_endpoint = base_endpoint + '/api/v3/ticker/price?' param_symbol_tag = '&symbol=' param_interval_tag = '&interval=' param_limit_tag = '&limit=' #price settings global profit_threshold_percent global stop_loss_threshold_percent global trailing_buy_threshold_percent global trailing_up_profit_stop_loss_percent global buy_low_threshold_percent global trade_with #'fiat' global trade_ticker_interval global min_bnb_holding profit_threshold_percent = 1.200 stop_loss_threshold_percent = -1.000 trailing_up_profit_stop_loss_percent = 0.3 buy_low_threshold_percent = 0.1 trailing_buy_threshold_percent = 0.3 min_bnb_holding = 1 trade_with = 'USDT' trade_ticker_interval = Client.KLINE_INTERVAL_1MINUTE #general settings global printline global bot_delay global milsec_in_a_min bot_delay = 1.0 #approx 1~2/sec printline = True milsec_in_a_min = 60000 #telegram bot settings global telegram_api_key global telegram_bot_username global telegram_firstname global telegram_api_endpoint global telegram_chat_id global method_telegram_sendmessage global param_telegram_chat_id global param_telegram_message telegram_api_key = '832263699:AAEbl8cenDp1pWdwWX5Bsv-36KjbQVvUBvM' telegram_bot_username = '******' telegram_firstname = 'trade transaction' telegram_api_endpoint = 'https://api.telegram.org/bot' telegram_chat_id = '330817807' method_telegram_sendmessage = '/sendmessage?' param_telegram_chat_id = 'chat_id=' + telegram_chat_id param_telegram_message = 'text='
print('select valid operation mode') mode = raw_input( 'Select a mode to run the cube in. To run from the microphone enter "M" and to run from the keyboard enter "k".\nEnter mode: ' ) except TypeError: print('select valid operation mode') choice = 0 #main code to run LED Cube try: #get input from either the keyboard or microphone depending on the user's choice while True: if (ord(mode) == ord('k') or ord(mode) == ord('K')): choice = key() elif (ord(mode) == ord('m') or ord(mode) == ord('M')): choice = Mphone() #display what pattern will run and then run that pattern print('running pattern', choice, '\n') if choice == 0: print('no input detected') elif choice == 1: turnOffer.turnOffFunc(cubeArray) tmp = loopAndBlink() tmp.loopAndBlinkFunc(cubeArray)
import signal import time import os from board import * from person import * from alarmexception import * from press import _GetchUnix as getChar from key import * from manage import * x = Board() x1 = key() temp1 = [[] for i in range(0, 8000)] k = 0 class Mario(Person): def generate(self): Board.board[self.x][self.y] = self.char Board.board[self.x][self.y + 1] = self.char Board.board[self.x + 1][self.y] = self.char Board.board[self.x + 1][self.y + 1] = self.char def move(self): def alarmhandler(signum, frame): raise AlarmException def user_input(timeout=0.1): signal.signal(signal.SIGALRM, alarmhandler) signal.setitimer(signal.ITIMER_REAL, timeout) try: