Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python3
- from tkinter import *
- import os
- Computers = [
- 'RaspberryPi3',
- 'PiUbuntu',
- 'Thylacoleo']
- def sel():
- cmd = "open afp://" + Computers[var.get()] + ".local"
- os.system( cmd )
- root = Tk() # create tkinter object
- root.title("Connect to Computer") # give the window a title...
- root.minsize(250, 100)
- var = IntVar()
- button=0
- for cc in Computers:
- R1 = Radiobutton(root, text=cc, variable=var, value=button, command=sel)
- R1.pack( anchor = W )
- button += 1
- root.mainloop()
- Computers = {
- 'RaspberryPi3': 'Pi3',
- 'PiUbuntu': 'PiUbuntu',
- 'Ubuntu-T': 'Thylaco'
- }
- def sel():
- print("selection", tvar)
- selection = "You selected the option " + tvar
- root = Tk() # create tkinter object
- root.title("Connect to Computer") # give the window a title...
- root.minsize(250, 100)
- # var = IntVar()
- # tvar = StringVar()
- tvar = str()
- button=0
- for cc in list(Computers.keys()):
- # R1 = Radiobutton(root, text=cc, variable=var, value=button, command=sel)
- R1 = Radiobutton(root, text=cc, variable=tvar, value=cc, command=sel)
- # R1 = Radiobutton(root, text=cc, textvariable=tvar, command=sel)
- R1.pack( anchor = W )
- root.mainloop()
Add Comment
Please, Sign In to add comment