''' Created on Mar 13, 2014 @author: Brett Paufler Copyright Brett Paufler 3-13-14 ''' import webbrowser import Tkinter as tk import imgur_logic imgBaseGalleryURL = "http://imgur.com/gallery/" #print imgBaseGalleryURL ''' #This is the default call\ #Others to be updated through this ''' def viewNextGallery(galleryObject): simpleFireFoxPageView(galleryObject) ''' Loads firefox and pushes the appropriate url Not very sophisticated ''' def simpleFireFoxPageView(galleryObject): print "simpleFireFoxPageView(galleryObject): called, target is..." nextImgurPage = imgBaseGalleryURL + str(galleryObject['gallery']) print nextImgurPage webView = webbrowser.get() webView.open(nextImgurPage, 1, False) print "simpleFireFoxPageView(galleryObject): end" # Copy and Paste the Appropriate code #button Call def downVote(x): print "No downVote Function yet" #button Call def upVote(x): print "No upVote Function Yet" def savePicture(x): print "No Save Picture Function Yet" ''' superceded by runSavePictureButtonTKinputBox(): ''' #tK code for very basic box #No saved picture option def runBasicTKinputBox(): myDisplay = tk.Tk() myDisplay.geometry('550x750') myDisplay.title('BiB - Better imgur Browser - Copyright 2014 Brett Paufler') imgFile = "tk.gif" tkImage = tk.PhotoImage(file = imgFile) canvas = tk.Canvas(width = 500, height = 500) canvas.create_image(250,250,image = tkImage) someValue = 0 button1 = tk.Button(myDisplay, text = 'DOWN VOTE', command = lambda: downVote(someValue)) button1.config(width=20, height=5) button1.place(x=100, y=650) button2 = tk.Button(myDisplay, text = 'UP VOTE', command = lambda: upVote(someValue)) button2.config(width=20, height=5) button2.place(x=300, y=650) canvas.pack() myDisplay.mainloop() ##ND runBasicTKinputBox(): ''' Implements the Interface Button Controls are located in the LOGIC module ''' def runSavePictureButtonTKinputBox(): print "runSavePictureButtonTKinputBox(): called" myDisplay = tk.Tk() myDisplay.geometry('500x750') myDisplay.title('BiB - Better imgur Browser - Copyright 2014 Brett Paufler') #transforms pic into tK usable format imgFile = "tk.gif" tkImage = tk.PhotoImage(file = imgFile) # canvas = tk.Canvas(width = 500, height = 500) # canvas.create_image(250,250,image = tkImage) someValue = 0 titleText="titleText = Title Space - This is a Holding Variable for Now" #aboveTitleBlankSpace = tk.Label(myDisplay, text="") #aboveTitleBlankSpace.grid(row=0, column=1) titleLabel = tk.Label(myDisplay, text=titleText) titleLabel.grid(row=2, column=1) titleLabel.config(width=50, height=1) #belowTitleBlankSpace = tk.Label(myDisplay, text="") #belowTitleBlankSpace.grid(row=1, column=1) buttonSave = tk.Button(myDisplay, text = 'SAVE', command = lambda: imgur_logic.savePicture(someValue)) buttonSave.grid(row=0, column=1) buttonSave.config(image=tkImage) buttonSave.config(width=500, height=500) #belowImageBlankSpace = tk.Label(myDisplay, text="") #belowImageBlankSpace.grid(row=3, column=1) commentTextOne = "commentTextOne = holding variable for now" commentLabelOne = tk.Label(myDisplay, text=commentTextOne) commentLabelOne.grid(row=4, column=1) commentTextTwo = "commentTextTwo = holding variable for now" commentLabelTwo = tk.Label(myDisplay, text=commentTextTwo) commentLabelTwo.grid(row=5, column=1) commentTextThree = "commentTextThree = holding variable for now" commentLabelThree = tk.Label(myDisplay, text=commentTextThree) commentLabelThree.grid(row=6, column=1) buttonUp = tk.Button(myDisplay, text = 'UP VOTE', command = lambda: imgur_logic.upVote(someValue)) buttonUp.config(width=50, height=3) buttonUp.grid(row=10, column=1) buttonDown = tk.Button(myDisplay, text = 'DOWN VOTE', command = lambda: imgur_logic.downVote(someValue)) buttonDown.config(width=50, height=3) buttonDown.grid(row=11, column=1) print "runSavePictureButtonTKinputBox() to mainloop, presumably running" myDisplay.mainloop() print "runSavePictureButtonTKinputBox(): ended, mainLoop Over" #END runSavePictureButtonTKinputBox():