Guest User

Untitled

a guest
Dec 18th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #! /usr/bin/env python3
  2.  
  3. from tkinter import *
  4. import os
  5.  
  6. Computers = [
  7. 'RaspberryPi3',
  8. 'PiUbuntu',
  9. 'Thylacoleo']
  10.  
  11. def sel():
  12. cmd = "open afp://" + Computers[var.get()] + ".local"
  13. os.system( cmd )
  14.  
  15. root = Tk() # create tkinter object
  16. root.title("Connect to Computer") # give the window a title...
  17. root.minsize(250, 100)
  18. var = IntVar()
  19. button=0
  20.  
  21. for cc in Computers:
  22. R1 = Radiobutton(root, text=cc, variable=var, value=button, command=sel)
  23. R1.pack( anchor = W )
  24. button += 1
  25.  
  26. root.mainloop()
  27.  
  28. Computers = {
  29. 'RaspberryPi3': 'Pi3',
  30. 'PiUbuntu': 'PiUbuntu',
  31. 'Ubuntu-T': 'Thylaco'
  32. }
  33.  
  34. def sel():
  35. print("selection", tvar)
  36. selection = "You selected the option " + tvar
  37.  
  38. root = Tk() # create tkinter object
  39. root.title("Connect to Computer") # give the window a title...
  40. root.minsize(250, 100)
  41. # var = IntVar()
  42. # tvar = StringVar()
  43. tvar = str()
  44. button=0
  45.  
  46. for cc in list(Computers.keys()):
  47. # R1 = Radiobutton(root, text=cc, variable=var, value=button, command=sel)
  48. R1 = Radiobutton(root, text=cc, variable=tvar, value=cc, command=sel)
  49. # R1 = Radiobutton(root, text=cc, textvariable=tvar, command=sel)
  50. R1.pack( anchor = W )
  51.  
  52. root.mainloop()
Add Comment
Please, Sign In to add comment