Snippets Collections
import customtkinter as ctk

root = ctk.CTk()
root.geometry('200x200')

led_on = '#4cff66'
led_off = '#1e3c22'

led = ctk.CTkLabel(root, text='\t', width=50, bg_color=led_off)
led.place(x = 80, y = 80)

def off_on():
    if led._bg_color == led_off:
        led.configure(bg_color = led_on)
        led.update()
        return
    
    if led._bg_color == led_on:
        led.configure(bg_color = led_off)
        led.update()
        return


bt = ctk.CTkButton(root, text = 'OFF/ON', command=off_on, width=70)
bt.place(x = 80, y = 150)

root.mainloop()
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 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()
import pyinstaller_versionfile

pyinstaller_versionfile.create_versionfile(
    output_file="test_versionfile.txt",
    version="1.0",
    company_name="somecompany pvt ltd",
    file_description="This is lms for desktop from some industry",
    internal_name="App",
    legal_copyright="© some companry pvt ltd. All rights reserved.",
    original_filename="Uls.exe",
    product_name="uls_lms"
)
pyinstaller  --noconsole --onefile  --icon=uls-icon.ico --version-file uls_lms_versionfile.txt  lms_app.py
star

Wed Aug 14 2024 13:55:13 GMT+0000 (Coordinated Universal Time)

##python #coding #python #programming #tkinter
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

Save snippets that work with our extensions

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