Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smartsheet
- import logging
- from tkinter import *
- token = "API KEY HERE"
- matt_workspace = 7813091611174788
- ss_client = smartsheet.Smartsheet(token) #Matt's workspace
- ss_client.errors_as_exceptions(True)
- #for gethering workspaces
- workspace_response = ss_client.Workspaces.list_workspaces(include_all=True)
- all_workspaces = workspace_response.data
- workspaces_name_and_id= []
- for x in all_workspaces:
- workspaces_name_and_id.append(([str(x.name)], x.id))
- selected_workspaces = []
- def raise_frame(frame):
- frame.tkraise()
- #TODO set up UI root
- import tkinter as tk # python 3
- from tkinter import font as tkfont # python 3
- def set_selected_workspaces(listbox):
- for x in listbox.curselection():
- selected_workspaces.append(workspaces_name_and_id[x])
- return selected_workspaces
- class WorkspacesPage(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.controller = controller
- label = tk.Label(self, text="Workspace Selection", font=controller.title_font)
- label.pack(side="top", fill="x", pady=10)
- wkdirections = tk.Label(self,
- text = "1. Press the 'gather' button to gather all your available workspaces. n 2. Select the workspaces with sheets you want to edit from the list. (Holding ctrl selects individual, holding shift selects en masse)")
- wkdirections.pack(side=RIGHT, anchor=CENTER)
- WorkspaceList = Listbox(self, selectmode=EXTENDED, width=100, height=50)
- WorkspaceList.pack(side=LEFT)
- for x in workspaces_name_and_id:
- WorkspaceList.insert(END, (x))
- button = tk.Button(self, text="Next", command=lambda: [controller.show_frame("FoldersPage"), set_selected_workspaces(WorkspaceList) ,print(selected_workspaces)], padx=20, pady=3)
- button.place(relx=0.975, rely=0.975, anchor=SE)
Add Comment
Please, Sign In to add comment