Skip to content

Instantly share code, notes, and snippets.

@ricardj
ricardj / tkinter-autocomplete-listbox.py
Last active July 14, 2020 12:53 — forked from uroshekic/tkinter-autocomplete-listbox.py
Tkinter - Autocomplete Entry Field
"""
Changes added by ricardj:
-Import now done with tk prefix instead of using the wildcard import.
-Down movement starts at zero.
-Now up and down movement is cyclic.
-Added return function in order to use the autocomplete-listbox as a tag selector. With out leaving the keyboard the user is going to be able to write with autocomplete and select some tags fast.
-List height reimplemented to make it adapt to the number of matching words. It would be great to define a max listbox length and not to fix the listbox length from the begining.
"""
#from tkinter import *
@ricardj
ricardj / Singleton.cs
Created November 13, 2022 07:54
Unity Monobehaviour Singleton
public class Singleton<T> : MonoBehaviour where T : Singleton<T>
{
public static T get;
public void Awake()
{
if (get == null)
{
get = (T)this;
}
@ricardj
ricardj / GUIList.cs
Created December 11, 2022 19:19
Script for spawning list items on UI in Unity.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GUIList<T> : MonoBehaviour where T : MonoBehaviour
{
[Header("GUI List configuration")]
[SerializeField] T _itemPrefab;
@ricardj
ricardj / ChangeSceneToEditorTool.cs
Created January 2, 2023 19:48
Tool for efficiently changing scene.
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEditor.SceneManagement;
using UnityEngine;
@ricardj
ricardj / ResetPlayerPrefsEditorTool.cs
Created January 2, 2023 19:49
Fast reset player prefs tool for unity.
using UnityEditor.EditorTools;
using UnityEngine;
[EditorTool("Reset player prefs")]
public class ResetPlayerPrefsEditorTool : EditorTool
{
[SerializeField]
Texture2D m_ToolIcon;
GUIContent m_IconContent;
@ricardj
ricardj / EventBus.cs
Created February 19, 2023 20:25
Unity Event Bus
using System.Collections.Generic;
using System;
public class EventBus
{
private static EventBus instance = null;
public static EventBus Instance
{