summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2024-02-06 15:42:07 -0300
committerJesusaves <cpntb1@ymail.com>2024-02-06 15:42:07 -0300
commitd28319dc3521cfce11119bd691ee817fa344ea6f (patch)
tree53e9158a22511f9bfb9862e618e62bca6b1dee2b
parente41854f5fb4962b65c8a44fa60841839b134c291 (diff)
downloadtkinter-d28319dc3521cfce11119bd691ee817fa344ea6f.tar.gz
tkinter-d28319dc3521cfce11119bd691ee817fa344ea6f.tar.bz2
tkinter-d28319dc3521cfce11119bd691ee817fa344ea6f.tar.xz
tkinter-d28319dc3521cfce11119bd691ee817fa344ea6f.zip
Hidden function: Right click on world to open its website
-rwxr-xr-x__main__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/__main__.py b/__main__.py
index 9e11373..75daf70 100755
--- a/__main__.py
+++ b/__main__.py
@@ -9,7 +9,7 @@
#####################################
import requests, json, traceback, subprocess, sys, time, os, uuid, base64
-import zipfile, shutil
+import zipfile, shutil, webbrowser
#import threading #hmac, struct # < - TODO: Necessary for TOTP-remember support
import tkinter as tk
from tkinter.messagebox import showinfo, showerror, askyesno
@@ -285,6 +285,11 @@ def info_game(idx):
message=serverlist[idx]["Desc"])
return
+## Open a game website
+def open_url(link, *etc):
+ webbrowser.open_new(link)
+ return
+
## Launch a specific world with its appropriate client
def launch_game(idx):
PWD=""
@@ -602,9 +607,11 @@ def world_select():
## TODO: Do not block main thread, launch this in a threading?
## TODO: Image button if an icon can be found
button = HoverButton(text=w["Name"], command=partial(launch_game_master, serverlist.index(w)), width=40, anchor="w", bg="#cc6600", fg="#fff", activebackground="#ee9933")
+ button.bind("<Button-3>", partial(open_url, w["Link"]))
canva.create_window(200, ypos, window=button)
## World Info Button
button = HoverButton(text="?", command=partial(info_game, serverlist.index(w)), bg="#cc6600", fg="#fff", activebackground="#ee9933")
+ button.bind("<Button-3>", partial(open_url, w["Link"]))
canva.create_window(370, ypos, window=button)
ypos += 40