I am trying to make it so when I select an option from my drop-down list and click ok it should open up a tab with the desired link.
Here is my code:
from tkinter import *
import tkinter as tk
import webbrowser
app = tk.Tk()
#Gets the selected item in list. Displays number in list
def ok ():
print (lb.curselection ())
#if lb.curselection == 0 webbrowser.open('https://www.win-rar.com/predownload.html?&L=0')
#if lb.curselection == 1 webbrowser.open('https://www.google.com/chrome/')
#if lb.curselection == 2 webbrowser.open('https://sourceforge.net/projects/openofficeorg.mirror/files/4.1.8/binaries/en-US/Apache_OpenOffice_4.1.8_Win_x86_install_en-US.exe/download')
#if lb.curselection == 3 webbrowser.open('https://get.adobe.com/uk/reader/download/?installer=Reader_DC_2020.013.20064_English_UK_for_Windows&os=Windows%2010&browser_type=KHTML&browser_dist=Chrome&dualoffer=false&mdualoffer=true&cr=false&stype=7775&d=McAfee_Security_Scan_Plus&d=McAfee_Safe_Connect')
#if lb.curselection == 4 webbrowser.open('https://download.mozilla.org/?product=thunderbird-78.5.1-SSL&os=win&lang=en-US')
#listbox
def OpenList():
global lb
lb = Listbox (app)
lb.insert (1, "WinRar")
lb.insert (2, "Google Chrome")
lb.insert (3, "OpenOffice")
lb.insert (4, "Adobe Reader")
lb.insert (5, "Thunderbird")
lb.grid (row = 3, column = 3)
but = Button (app, text="OK", command=ok)
but.grid ( row = 4, column = 3)
softwareManagerLabel = Label (app , text="Software Manager")
softwareManagerLabel.grid (row = 0, column = 3)
#Button opens listbox
dropDownButton = tk.Button(app, text="Install a Program From The Network", command=OpenList)
dropDownButton.grid (row = 1, column = 3)
I have commented out the links for now. Any help would be appreciated!