Brak podglądu blog.furas.pl · python/tkinter Tkinter: Jak użyć pynput keyboard listener razem z GUI tkinter W dokumentacji można zobaczyć przykład dla Monitoring the keyboard with keyboard.Listener(on_press=on_press, on_release=on_release) as listener: listener.join() który blokuje kod w... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/tkinter tekst [PL] import tkinter as tk def select(event): widget = root.winfo_containing(event.x_root, event.y_root) if widget and hasattr(widget, 'selectable'): widget['bg'] = 'red' root = tk.Tk()... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python selenium Selenium: How to login using css_selector It uses css selector to find element. import selenium.webdriver driver = selenium.webdriver.Firefox() driver.get('http://quotes.toscrape.com/login') item = driver.find_element_by_c... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python selenium Selenium: Jak wykonać logowanie z uzyciem css_selector Przykład używa css selector do znalezienia elementu. import selenium.webdriver driver = selenium.webdriver.Firefox() driver.get('http://quotes.toscrape.com/login') item = driver.fi... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl Selenium Example: login using css_selector [GB] It uses css selector to find element. \n import selenium.webdriver \n\n driver = selenium . webdriver . Firefox () \n driver . get ( 'http://quotes.toscrape.com/login' ) \n\n item... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl BeautifulSoup: get text from tag [GB] There are different functions to get text from tag. \n .text - all text from tag and subtags \n .string - only if there is no subtags \n .get_text(strip, separator) - you can remov... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl BeautifulSoup: pobranie tekstu z tagu Jest kilka róznych funkcji do pobierania tekstu z tagu. \n .text - cały tekst z tagu i podtagów \n .string - tylko jeśli nie ma podtagów \n .get_text(strip, separator) - można usun... 21.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/tkinter Tkinter: Using after() to display time [GB] Using root.after(milliseconds, callback) you can run function with delay. You can use it to display current time import tkinter as tk import time # --- function --- def update_time... 12.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/tkinter Tkinter: Użycie after() do wyświetlania czasu Używajac root.after(milliseconds, callback) można uruchomić funkcję z opoźnieniem. Można to wykorzystać do wyświetlannia aktualnego czasu import tkinter as tk import time # --- fun... 12.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/pygame PyGame draw background checkerboard [GB] import pygame # --- constants --- (UPPER_CASE_NAMES) SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 FPS = 25 GRAY_1 = (128,128,128) GRAY_2 = (192,192,192) # --- main --- pygame.init() scre... 11.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/pygame PyGame rysowanie tła w szachownicę import pygame # --- constants --- (UPPER_CASE_NAMES) SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 FPS = 25 BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0)... 11.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/pygame PyGame transparent Surface [GB] If you use surface.set_colorkey([0,0,0]) then later blit() will skip pixels which have color [0,0,0] This way you can remove background from surface or loaded image. In this exampl... 11.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python PyAutoGui type native chars with delay [GB] pyautogui doesn't sends ascii char to program - it sends to system key code normally used for this char and system uses this key code to send char to program. But if system uses no... 07.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python Use bash to run code in subprocess [GB] subprocess as default uses /bin/sh instead of popular /bin/bash so some syntax doesn't work import subprocess print(subprocess.check_output("for num in {2..4}; do echo $num; done",... 07.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python Użycie bash do wykonania kodu w subprocess subprocess domyślnie używa /bin/sh zamiast popularnego /bin/bash więc niektóra składnia nie działa import subprocess print(subprocess.check_output("for num in {2..4}; do echo $num;... 07.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python requests How to use Requsts to send arguments in url, POST data, JSON data or file to Flask This code will display different data from requests to show how flask get them. from flask import Flask, request app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def... 06.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python scraping Scraping incomplete data with Selenium Sometimes people scrape separatelly different values from page all_names = driver.find_elements_by_xpath('.//h3/a') all_prices = driver.find_elements_by_class_name('price_color') a... 06.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python scraping Scraping niekompletnych danych z Selenium Czasami ludzie zbierają oddzielnie różne wartości ze strony all_names = driver.find_elements_by_xpath('.//h3/a') all_prices = driver.find_elements_by_class_name('price_color') all_... 06.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/tkinter Use down arrow to jump from last to first row in Treeview It uses bind() to execute function when you press Down arrow in Treeview. Function checks if you are in last row last = tree.get_children()[-1] if tree.focus() == last: and moves f... 06.01.2020 blog.furas.pl
Brak podglądu blog.furas.pl · python/tkinter Użycie strzałki w dół aby przeskoczyć z ostatniego do pierwszego wiersza w Treeview Kod używa bind() aby wywołać funkcję gdy zostaje wciśnieta strzałka w dół Down w Treeview. Funkcja sprawdza czy jesteśmy w ostatnim wierszu last = tree.get_children()[-1] if tree.f... 06.01.2020 blog.furas.pl