aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-06-14 13:30:59 -0400
committerB Stack <bgstack15@gmail.com>2019-06-14 13:30:59 -0400
commit0336ab97c7889a2ea740336f49bbe92e413e9918 (patch)
tree41525568d6ec0c646723d06e9c737b14191db0b6
parentadd features to tcl frontend (diff)
downloadlogout-manager-0336ab97c7889a2ea740336f49bbe92e413e9918.tar.gz
logout-manager-0336ab97c7889a2ea740336f49bbe92e413e9918.tar.bz2
logout-manager-0336ab97c7889a2ea740336f49bbe92e413e9918.zip
import tkinter, instead of from tkinter import *
-rwxr-xr-xlogout-manager-tcl.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/logout-manager-tcl.py b/logout-manager-tcl.py
index 305c3a7..e8bf095 100755
--- a/logout-manager-tcl.py
+++ b/logout-manager-tcl.py
@@ -11,7 +11,7 @@
# http://effbot.org/tkinterbook/button.htm
# http://effbot.org/tkinterbook/tkinter-application-windows.htm
# http://effbot.org/tkinterbook/
-# pass parameters to function of Button(command=) https://stackoverflow.com/questions/38749620/python-3-tkinter-button-commands#38750155
+# pass parameters to function of tkinter.Button(command=) https://stackoverflow.com/questions/38749620/python-3-tkinter-button-commands#38750155
# alternate for passing params https://stackoverflow.com/questions/6920302/how-to-pass-arguments-to-a-button-command-in-tkinter
# https://stackoverflow.com/questions/18537918/set-window-icon#18538416
# the exact syntax <Alt-k> for master.bind https://stackoverflow.com/questions/16082243/how-to-bind-ctrl-in-python-tkinter
@@ -27,7 +27,7 @@
# python36-pillow-tk | python3-pil.imagetk
import os, sys, configparser, glob, re
-from tkinter import *
+import tkinter
from functools import partial
from pathlib import Path
from PIL import Image, ImageTk
@@ -143,10 +143,10 @@ def get_scaled_icon(icon_name, size = 24, fallback_icon_name = "", icon_theme =
class App:
def __init__(self, master):
- frame = Frame(master)
+ frame = tkinter.Frame(master)
frame.grid(row=0)
- self.buttonLock = Button(frame, text="Lock", underline=3, command=partial(actions.lock,config))
+ self.buttonLock = tkinter.Button(frame, text="Lock", underline=3, command=partial(actions.lock,config))
self.buttonLock.grid(row=0,column=0)
# WORKS master.bind_all("<Alt-k>", something)
# PASSES 2 params when expecting 1 master.bind_all("<Alt-k>", self.buttonLock.invoke)
@@ -154,35 +154,35 @@ class App:
# WORKS, for basic image loading.
#self.photoLogout = get_scaled_icon("/usr/share/icons/Adwaita/48x48/actions/system-log-out.png")
- #self.buttonLogout = Button(frame, text="Logout", underline=0, command=lambda: actions.logout(config), image=self.photoLogout, compound=TOP)
+ #self.buttonLogout = tkinter.Button(frame, text="Logout", underline=0, command=lambda: actions.logout(config), image=self.photoLogout, compound=TOP)
#self.photoLogout1 = Image.open("/usr/share/icons/Adwaita/48x48/actions/system-log-out.png")
#self.photoLogout1.thumbnail(size=[24,24])
#self.photoLogout = ImageTk.PhotoImage(self.photoLogout1,size="24x24")
#self.photoLogout = get_scaled_icon("/usr/share/icons/Adwaita/48x48/actions/system-log-out.png", 24)
#self.photoLogout = get_scaled_icon("system-log-out", 24, icon_theme="default")
self.photoLogout = get_scaled_icon(config.get_logout_icon(), config.get_icon_size(), config.get_icon_theme())
- self.buttonLogout = Button(frame, text="Logout", underline=0, command=lambda: actions.logout(config), image=self.photoLogout, compound=LEFT)
+ self.buttonLogout = tkinter.Button(frame, text="Logout", underline=0, command=lambda: actions.logout(config), image=self.photoLogout, compound=tkinter.LEFT)
master.bind_all("<Alt-l>", partial(actions.logout,config))
self.buttonLogout.grid(row=0,column=1)
self.photoHibernate = get_scaled_icon(config.get_hibernate_icon(), config.get_icon_size(), config.get_icon_theme())
- self.buttonHibernate = Button(frame, text="Hibernate", underline=0, command=lambda: actions.hibernate(config), image=self.photoHibernate, compound=LEFT)
+ self.buttonHibernate = tkinter.Button(frame, text="Hibernate", underline=0, command=lambda: actions.hibernate(config), image=self.photoHibernate, compound=tkinter.LEFT)
self.buttonHibernate.grid(row=0,column=2)
master.bind_all("<Alt-h>", partial(actions.hibernate,config))
self.photoShutdown = get_scaled_icon(config.get_shutdown_icon(), config.get_icon_size(), config.get_icon_theme())
- self.buttonShutdown = Button(frame, text="Shutdown", underline=0, command=lambda: actions.shutdown(config), image=self.photoShutdown, compound=LEFT)
+ self.buttonShutdown = tkinter.Button(frame, text="Shutdown", underline=0, command=lambda: actions.shutdown(config), image=self.photoShutdown, compound=tkinter.LEFT)
self.buttonShutdown.grid(row=0,column=3)
master.bind_all("<Alt-s>", partial(actions.shutdown,config))
self.photoReboot = get_scaled_icon(config.get_reboot_icon(), config.get_icon_size(), config.get_icon_theme())
- self.buttonReboot = Button(frame, text="Reboot", underline=0, command=lambda: actions.reboot(config), image=self.photoReboot, compound=LEFT)
+ self.buttonReboot = tkinter.Button(frame, text="Reboot", underline=0, command=lambda: actions.reboot(config), image=self.photoReboot, compound=tkinter.LEFT)
self.buttonReboot.grid(row=0,column=4)
master.bind_all("<Alt-r>", partial(actions.reboot,config))
- #self.buttonCancel = Button(frame, text="Cancel", underline=0, command=frame.quit)
- self.buttonCancel = Button(frame, text="Cancel", underline=0, command=self.quitaction)
- self.buttonCancel.grid(row=1,columnspan=8,sticky=W+E)
+ #self.buttonCancel = tkinter.Button(frame, text="Cancel", underline=0, command=frame.quit)
+ self.buttonCancel = tkinter.Button(frame, text="Cancel", underline=0, command=self.quitaction)
+ self.buttonCancel.grid(row=1,columnspan=8,sticky=tkinter.W+tkinter.E)
master.bind_all("<Alt-c>", self.quitaction)
# Found this after trial and error.
@@ -194,7 +194,7 @@ class App:
#def something(event=None):
# print("Got here!")
-root = Tk()
+root = tkinter.Tk()
# MAIN LOOP
root.title("Log out options")
bgstack15