Search results

  1. fukurou

    🐍 python python grimoire

    # raise custom error h = float(input("height")) if h > 3: raise ValueError("shingeki kyoujin")
  2. fukurou

    🐍 python python grimoire

    try try code snippet except err_type code to run on fail or key word 'pass' to not do anything else code to run on no err finally runs anyways try: file = open("non_existing_file.txt") except: print("Ha Ha file not fount err") file = open("non_existing_file.txt", "w") # create the...
  3. fukurou

    🐍 python python grimoire

    clipboard management import pyperclip # https://pypi.org/project/pyperclip/ pyperclip.copy(str) # copy str to the clipboard
  4. fukurou

    🐍 python python grimoire

    reverse split list into a string str1.join(list) # "" to join without buffer string between elements focus on entry : e1 = Entry(width=35) e1.focus() e1.insert(0, "text") # insert text to entry, use END for the last index e1.delete(0,END) # clear entry
  5. fukurou

    🐍 python python grimoire

    tkinter timer example import math from tkinter import * # ---------------------------- CONSTANTS ------------------------------- # # color pallets hex codes : colorhunt.co PINK = "#e2979c" RED = "#e7305b" GREEN = "#9bdeac" YELLOW = "#f7f5dd" FONT_NAME = "Courier" WORK_MIN = 25...
  6. fukurou

    🐍 python python grimoire

    TKinter Layout managers place layout manager : from tkinter import * # window GUI for the program window = Tk() window.title("GUI test") window.minsize(width=500, height=300) # add a label : lbl1 = Label(text="label1", font=("Times", 24, "bold")) lbl1.place(x=0, y=0) #precise layout manager...
  7. fukurou

    [MEDIA]

  8. fukurou

    ⚡ arduino PID formula

    PID = P + I + D err = setpoint-processValue P = K(err) reset = reset + k/tau_i*err I = reset //once err changes direction or zero reset =0 D = K/tau_i*(error-lastError); lastErr = err; K : gain : this is twicked K/tau_i : can also be twicled for optimal performance tau_i : second per repeat...
  9. fukurou

    👨‍💻 dev active task

    translate to python : Cerabellum : public class Cerabellum { // runs an algorithm private int fin; private int at; private enumFail failType; private Boolean incrementAt = false; public void advanceInAlg() { if (incrementAt) { incrementAt = false...
  10. fukurou

    🐍 python Chii's python suit

    RegexUtil and ZeroTimeGate ''' ----------------- REGEXUTIL ---------------- ''' import re from typing import Match, Pattern from collections import Counter from math import sqrt class Point: def __init__(self, x_init, y_init): self.x = x_init self.y = y_init def...
  11. fukurou

    [MEDIA]

  12. fukurou

    zerotimegate add explicit vars

    :skn::skn::skn::skn::skn::skn:
  13. fukurou

    zerotimegate add explicit vars

    ''' --------------- ZEROTIMEGATE --------------- ''' import time import datetime from datetime import timedelta ''' ZEROTIMEGATE CLASS ''' class ZeroTimeGate: # a gate that only opens x minutes after it has been set def __init__(self, minutes) -> None: self.pause = 1...
  14. fukurou

    oh this ?

    public void open(int minutes) { Date now = new Date(); openedGate = addMinutesToJavaUtilDate(now, minutes); } in java it is an inferred this actually so the program reads it as public void open(int minutes) { Date now = new Date(); this.openedGate =...
  15. fukurou

    current state regexutil

    ''' ----------------- REGEXUTIL ---------------- ''' import re from typing import Match, Pattern from collections import Counter from math import sqrt class Point: def __init__(self, x_init, y_init): self.x = x_init self.y = y_init def shift(self, x, y): self.x...
  16. fukurou

    numberRegex fixed

    def numberRegex(self, str2Check: str) -> str: theRegex = r"[-+]?[0-9]*[.,][0-9]*" list1: list[str] = [] regexMatcher = re.search(theRegex, str2Check) if (regexMatcher != None): return regexMatcher.group(0).strip() return ""
  17. fukurou

    addressing issues

    ''' ----------------- REGEXUTIL ---------------- ''' import re from typing import Match, Pattern from collections import Counter from math import sqrt class Point: def __init__(self, x_init, y_init): self.x = x_init self.y = y_init def shift(self, x, y): self.x...
  18. fukurou

    addressing issues

    continue work from this code as many errors were modified : use explicit variables see line 226 numberRegex("hello-789.998world")) # err : doesn't return decimal value (should be -789.998) print("The regexChecker2 method should return ?: ", regex.regexChecker2(r"[-+]?[0-9]{1,13}"...
  19. fukurou

    [MEDIA]

Top