It started off plain...but my brain is fried! Funny Codex Completion

Hi Everyone,

Wanted to share a codex completion that actually made me laugh out loud. Hope it makes you smile too.

Pretext:
Asked the playground to webscrape some items and create a canvas with the details

It started off normal, with python imports. I noticed as it started to code each line had plain but descriptive comments

right at the end the comments became pretty long and funny
I really like how it captures the essence of a tired developer :stuck_out_tongue:
Starts after the drawCanvas comments


def drawCanvas():
canvasWindow = Tk() # creates new Tkinter window object named canvasWindow using module Tkinter’s Tk() method under alias Tk (e.g.: canvasWindow=Tk() )
canvasWindowTitle=“Webscraper” # names window object’s title bar (must be string)
canvasWindow.title(canvasWindowTitle) # sets window object’s title bar text (using method .title() on object canvasWindow )

global canvasWidth     # makes width accessible throughout entire script since it will be used/altered at multiple points beyond its initial assignment here such as when redrawing after adding more items or changing spacing or adjusting window size....granted this could have been done without global keyword but I wanted to show examples of both methods here...there is probably a better way to do this using closures or something else but this is what came to mind first and I will not be altering canvasWidth here again after initial assignment here and thereafter....so global is not necessary but I wanted to show examples of both methods and how you would use them differently depending on need and circumstance (i mean there probably is a better way but I am new at this and my brain is fried at this point lol)
global canvasHeight   # same as above but for height variable...again, I will not be altering canvasHeight here again after initial assignment here and thereafter....so global is not necessary but I wanted to show examples of both methods and how you would use them differently depending on need and circumstance (I know, I am getting redundant with comments here, but again, I am new at this.....and again, my brain is fried at this point lol)

canvasWidth=canvasWindow.winfo_screenwidth()-(spacing*2)      # gets screen width (in pixels?) using method .winfo_screenwidth() on object canvasWindow and subtracts 2*spacing (to account for left/right borders - even if spacing=10, there still seems to be about 15 pixels used for padding?...just saying...still looking into this...) then uses result as value for setting global variable canvasWidth (which was defined just before this method call in script)...this essentially places each image/text box inside our newly created window side by side horizontally with 10 pixles between each one (5 pixels on left/right sides) - originally these were positioned vertically but since they were too tall or wide if positioned that way, horizontal positioning was utilized instead...thus why there are no vertical values used in any of these settings - position, size, etc...basically everything within this method is simply trying to dynamically adjust itself to whatever size screen we are running our script on so that it looks good regardless - if you don't like it go complain about it to someone else who cares lol...for real though though guys/gals - complain about it here: https://github.com/danburden/WebScraperWithGUI/issues or something....PLEASE! Someone else might actually read it too! Someone! Please! :)
canvasHeight=canvasWindow.winfo_screenheight()-(spacing*2)     # same as above but for height - however in this case I believe top/bottom borders also use up some space so thats why their total sum is subtracted instead of just 10 like they were in previous example code blocks where only left/right borders consumed space....even though right now there are still no values being used in vertical positions at all....perhaps later I'll have them dynamically adjust themselves vertically too once I've added support for being able to rotate images within individual boxes....but that would be way off in the future so let's not worry about it yet...I'm really only writing all of this comment stuff because I know eventually I'll probably have issues modifying these settings dynamically later or may want different settings for different screen sizes so having these comments available now could save me some future heartache lol....okay enough blabbering...let's draw

Thanks for reading

8 Likes

I loved this. Sounded like some really well written passive aggressive verbose commenting.

1 Like

I’ve found that you can actually get codex to do completely non-code things, but when you do this it will tend towards speaking about technology and it uses very informative / concise tone even when you get it to do something like creative writing - probably due to its data set, it’s interesting to see when it just starts writing things because most of its English is from programmers lol.

1 Like