This is a personal record of my python programming experiences. It will allow me to see how I am progressing as I learn a new language.
Showing posts with label Python option menu. Show all posts
Showing posts with label Python option menu. Show all posts
Tuesday, September 14, 2010
Saturday, September 11, 2010
My first option menu written in Python 2.6
I am learning how to create option menus with Python. I made a very simple one that opens web pages. This is just a learning excercise, and it is very simple. I have to start somewhere.
pages. from Tkinter import *
import webbrowser
#My first OptionMenu widget written in Python 2.6
def OpenWeb():
showWeb=theAction.get()
if showWeb=='My blog':
webbrowser.open('http://stevespythonprogramadventures.blogspot.com/')
if showWeb=='open SNCO':
webbrowser.open('http://www.snco.us/default.asp')
if showWeb=='GISviewer':
webbrowser.open('http://gis.snco.us/PublicGIS/')
root=Tk()
theAction=StringVar()
theAction.set(None)
OptionMenu(root,theAction,'My blog','open SNCO','GISviewer').pack()
abtn=Button(root, text='go!',command=OpenWeb)
abtn.pack()
root.mainloop()
pages. from Tkinter import *
import webbrowser
#My first OptionMenu widget written in Python 2.6
def OpenWeb():
showWeb=theAction.get()
if showWeb=='My blog':
webbrowser.open('http://stevespythonprogramadventures.blogspot.com/')
if showWeb=='open SNCO':
webbrowser.open('http://www.snco.us/default.asp')
if showWeb=='GISviewer':
webbrowser.open('http://gis.snco.us/PublicGIS/')
root=Tk()
theAction=StringVar()
theAction.set(None)
OptionMenu(root,theAction,'My blog','open SNCO','GISviewer').pack()
abtn=Button(root, text='go!',command=OpenWeb)
abtn.pack()
root.mainloop()
Subscribe to:
Posts (Atom)
Followers
Blog Archive
- June (1)
- March (3)
- February (1)
- July (3)
- May (1)
- April (1)
- March (1)
- January (1)
- December (1)
- November (4)
- July (3)
- May (2)
- April (1)
- March (6)
- February (2)
- December (1)
- November (1)
- September (3)
- August (3)
- July (1)
- March (3)
- January (1)
- December (5)
- November (2)
- October (1)
- September (2)
- August (1)
- July (4)
- May (3)
- February (1)
- January (1)
- December (1)
- November (2)
- October (2)
- September (9)
- August (2)
- May (1)
- April (1)
- March (6)
- February (5)
- January (3)
- August (2)


