Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Created January 3, 2024 22:20
Show Gist options
  • Save raspberrypisig/f06955d8e27d755caa3d954901215459 to your computer and use it in GitHub Desktop.
Save raspberrypisig/f06955d8e27d755caa3d954901215459 to your computer and use it in GitHub Desktop.
raygui raylib
from threading import Thread
from pyray import *
from raylib import *
from time import sleep
# control variables
downloadPressed = False
uploadPressed = False
def download():
while True:
global downloadPressed
if downloadPressed:
print("download")
downloadPressed = False
sleep(0.1)
def upload():
while True:
global uploadPressed
if uploadPressed:
print("upload")
uploadPressed = False
sleep(0.1)
downloadthread = Thread(target=download, daemon=True)
downloadthread.start()
downloadthread = Thread(target=upload, daemon=True)
downloadthread.start()
init_window(800, 550, "Hello")
set_target_fps(10)
headingfont = load_font("fonts/WhiteRabbit.otf")
font = load_font_ex("fonts/SourceCodePro-Regular.ttf",48, None, 0)
#defaultfont = get_font_default()
gui_set_style(BUTTON, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_BOTTOM)
gui_set_style(DEFAULT, TEXT_SIZE, 48)
gui_set_font(font)
while not window_should_close():
begin_drawing()
clear_background(WHITE)
draw_text_ex(headingfont, "VSCode Portable Downloader", (50, 50), 36, 0, PURPLE)
if gui_button(Rectangle(100, 150, 600,100), "Download VScode Portable"):
downloadPressed = True
if gui_button(Rectangle(100, 300, 600,100), "Update VScode Portable"):
uploadPressed = True
end_drawing()
close_window()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment