Guest User

Untitled

a guest
Jul 16th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. import smartsheet
  2. import logging
  3. from tkinter import *
  4.  
  5. token = "API KEY HERE"
  6. matt_workspace = 7813091611174788
  7. ss_client = smartsheet.Smartsheet(token) #Matt's workspace
  8.  
  9. ss_client.errors_as_exceptions(True)
  10.  
  11. #for gethering workspaces
  12.  
  13. workspace_response = ss_client.Workspaces.list_workspaces(include_all=True)
  14. all_workspaces = workspace_response.data
  15. workspaces_name_and_id= []
  16. for x in all_workspaces:
  17. workspaces_name_and_id.append(([str(x.name)], x.id))
  18.  
  19. selected_workspaces = []
  20.  
  21. def raise_frame(frame):
  22. frame.tkraise()
  23.  
  24. #TODO set up UI root
  25. import tkinter as tk # python 3
  26. from tkinter import font as tkfont # python 3
  27.  
  28. def set_selected_workspaces(listbox):
  29. for x in listbox.curselection():
  30. selected_workspaces.append(workspaces_name_and_id[x])
  31. return selected_workspaces
  32.  
  33. class WorkspacesPage(tk.Frame):
  34.  
  35. def __init__(self, parent, controller):
  36. tk.Frame.__init__(self, parent)
  37. self.controller = controller
  38.  
  39. label = tk.Label(self, text="Workspace Selection", font=controller.title_font)
  40. label.pack(side="top", fill="x", pady=10)
  41.  
  42. wkdirections = tk.Label(self,
  43. 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)")
  44. wkdirections.pack(side=RIGHT, anchor=CENTER)
  45.  
  46. WorkspaceList = Listbox(self, selectmode=EXTENDED, width=100, height=50)
  47. WorkspaceList.pack(side=LEFT)
  48.  
  49. for x in workspaces_name_and_id:
  50. WorkspaceList.insert(END, (x))
  51.  
  52. button = tk.Button(self, text="Next", command=lambda: [controller.show_frame("FoldersPage"), set_selected_workspaces(WorkspaceList) ,print(selected_workspaces)], padx=20, pady=3)
  53. button.place(relx=0.975, rely=0.975, anchor=SE)
Add Comment
Please, Sign In to add comment