Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vigilantPotato
vigilantPotato / Pipfile
Last active January 20, 2019 12:06
images
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
@vigilantPotato
vigilantPotato / tk_button.ipynb
Created January 20, 2019 12:17
tkinter button options
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vigilantPotato
vigilantPotato / move_to_display_edge.py
Last active April 19, 2023 13:45
how to just fit tkinter main window to the edge of display
import ctypes
import tkinter
"""Note
Tkinter main window has invisible frame around it.
When you want to just fit the main window to the edge of display,
you have to consider the width of the invisible frame.
For example, when you use root.geometry("+0+100"),
@vigilantPotato
vigilantPotato / input_dialog.py
Created April 23, 2023 14:25
example of a simple input dialog
import tkinter
class InputDialog(tkinter.Toplevel):
"""
show a dialog which asks user to input something
"""
def __init__(self, root):
super().__init__(root)
@vigilantPotato
vigilantPotato / change_color_on_hover.py
Last active April 24, 2023 13:57
how to change tkinter's widget color on hover
import tkinter
class ChangeColorOnHoverButton(tkinter.Button):
"""
button class which changes its background color on hover
"""
def __init__(self, root):
super().__init__(
@vigilantPotato
vigilantPotato / move_widget_by_dragging.py
Last active January 7, 2024 22:18
example of moving button by dragging
import tkinter
class MoveButtonByDragging(tkinter.Button):
"""
button which can move by dragging
"""
def __init__(self, root):
super().__init__(
@vigilantPotato
vigilantPotato / move_window_to_corner.py
Last active January 15, 2024 14:26
how to move the tkinter main window to the corner of the screen
import tkinter
#Button which moves main window to the top-right of the screen
class MovePositionButton(tkinter.Button):
def __init__(self, master):
super().__init__(
master,
width=15,
text="click",
command=self.move_position,
@vigilantPotato
vigilantPotato / move_main_window_when_button_is_mapped.py
Created January 19, 2024 14:21
[tkinter] <Map> event example (move main window when widget appears)
import tkinter
#Move the main window to the top-right of monitor when this button appears
class DummynButton(tkinter.Button):
def __init__(self, master):
super().__init__(
master,
width=15,
text="click",
)