Snippets Collections
import tkinter as tk


root = tk.Tk()
root.attributes('-fullscreen', True)

# this is very important
def close_fullscreen():
    root.attributes('-fullscreen', False)

# add bt to close fullscreen mode this is very important
close_bt = tk.Button(root, text='Close full screen mode', command=close_fullscreen)
close_bt.pack(fill=tk.BOTH)

root.mainloop()
import pyaudio
import numpy as np
import pyqtgraph as pg

# Initialize PyAudio
pa = pyaudio.PyAudio()

# Set up audio stream
stream = pa.open(
    format=pyaudio.paInt16,
    channels=1,
    rate=44100,
    input=True,
    frames_per_buffer=1024
)

# Set up PyQTGraph
app = pg.mkQApp()
win = pg.GraphicsLayoutWidget()
win.show()
plot = win.addPlot(title='Real-time Audio Waveform')
curve = plot.plot()

# Function to update the plot
def update():
    wf_data = np.frombuffer(stream.read(1024), dtype=np.int16)
    curve.setData(wf_data)

# Start the audio stream
timer = pg.QtCore.QTimer()
timer.timeout.connect(update)
timer.start(50)

# Start Qt event loop
pg.mkQApp().exec()

import customtkinter as ctk
import threading


run = True

def task():
    while run:
        print('Task running...')
        if not run:
            print('Task closed')
            return
        
def start_task():
    global run
    run = True
    threading.Thread(target=task).start()


def close_task():
    global run
    run = False

root = ctk.CTk()
root.geometry('500x60')

ctk.CTkButton(root, text='start task', command=start_task).place(x = 20, y = 10)
ctk.CTkButton(root, text='close task', command=close_task).place(x = 220, y = 10)

root.mainloop()
sudo apt-get -y install xfce4 && sudo apt-get -y install xubuntu-desktop

sudo apt-get -y install xrdp

echo xfce4-session > ~/.xsession

sudo service xrdp restart

ifconfig | grep inet

<i>Then connect to the IP the is returned by the last command</i>

<img src="https://adamtheautomator.com/wp-content/uploads/2019/09/windows-subsystem-linux-gui.png"></img>
# Create a ".desktop" file in "/usr/share/applications" with following content

[Desktop Entry]
Name=NameOfApplication
Exec=/path/to/your/script
Icon=/path/to/image/to/use/as/icon.png
Terminal=false
Type=Application
star

Sat Apr 13 2024 08:57:39 GMT+0000 (Coordinated Universal Time)

##python #coding #tkinter #gui #python
star

Tue Feb 15 2022 19:49:07 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/40661739/pyinstaller-windowed-or-noconsole-exe-not-allowing-chromedriver-to-open/53640014

#python #tkinter #pyinstaller #gui #executableapp
star

Tue Jan 04 2022 01:24:10 GMT+0000 (Coordinated Universal Time) https://xwordpress.org

#bash #windows #wsl #wsl2 #gui
star

Tue Jun 08 2021 08:36:37 GMT+0000 (Coordinated Universal Time) https://www.computerwissen.de/linux/distributionen/ubuntu/ubuntu-programme/so-erstellen-sie-einen-eigenen-starter/

#ubuntu #scripts #gui

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension