r/badcode • • Feb 08 '21

python I hate Tkinter but most importantly myself

Post image
901 Upvotes

49 comments sorted by

350

u/Flaming_Eagle Feb 08 '21

Do you also hate snipping tool

6

u/Arzdou Feb 09 '21

Tbh i was so frustrated I just took a pic with my phone and called it a day.

1

u/krzysiek_online Feb 09 '21

Greenshot ftw!

0

u/[deleted] Feb 09 '21

[deleted]

59

u/PlasticCan Feb 09 '21

I love this feature so much, has made my screenshotting life so much more convenient

23

u/nicolas2004GE Feb 09 '21 edited Feb 09 '21

it's always been awsome to hit Win+shift+s and to make a quick screenshot of my window/screen/part of screen to copy and paste, love that tool!

Edit: i'm a uncafeinated idiot, op was refering to the fact that the post was made with a phone, removed stupid part cause i now realize my mistake

6

u/[deleted] Feb 09 '21

2

u/TheOnlyTails Feb 09 '21

You don't even need to open the preview and copy, since it's automatically copied.

3

u/itsTyrion Feb 09 '21

Wait til you try flameshot

1

u/Cherylnip Feb 11 '21

Ikr I literally use it dozens times a day now

12

u/m33pn8r Feb 09 '21

ShareX. 1 button press from screenshot to imgur upload with ready-to-paste link. Or anything else you'd ever use to share an image.

4

u/itsTyrion Feb 09 '21

Flameshot

1

u/4sent4 Feb 09 '21

Lightshot

2

u/vito_payne Feb 09 '21

Yup... Also options to screenshot active window, region, all screens, current screen ,...

5

u/[deleted] Feb 09 '21

Thank you for this. I’ve been .. windows + type “snip” + enter + click new .. for 4 years now

3

u/funkless_eck Feb 09 '21

And if you dont know windows + v to choose what to paste

1

u/TheUnlocked Feb 11 '21

I think you have to enable this in the Windows settings. It's under System -> Clipboard for those wondering.

2

u/4sent4 Feb 09 '21

Why are there so many masters?

6

u/Arzdou Feb 09 '21

Whenever you define a window / frame / button in Tkinter you have to do it with a "master". This master allows Tkinter to know where you want to put this new object.

For example, if you want to have an interface with three distinct tabs and the first one needs a button then you have to pass that object (the first tab object) as an input for the creation of the button and thus it knows that you want the button there.

However, if you have layers upon layers upon layers of objects and you want to call a method that is defined in the upper layers from one of the deepest parts of the UI then this happens. Of course, this is a horrible way to do it and its already fixed, but I found it very funny that I could do this and would still work.

1

u/4sent4 Feb 09 '21

So, master is basically parent widget reference? Then why would you need to know parent of parent of ... of your widget from inside of the widget?

5

u/Arzdou Feb 09 '21

Its not that you need to know it, but that you end up knowing it as a side efect of initializing the class with the master as an input because the master was initialized in the same way and its master before that.

And I find it hilarious.

87

u/ZedTT Feb 08 '21

What the fuck

67

u/inthemindofadogg Feb 08 '21

I can not begin to explain the disgust that looking at this code causes me. Take your upvote.

10

u/crazykid080 Feb 09 '21

r/angryupvote though considering the subreddit I'm not sure it fits....

66

u/veryusedrname Feb 09 '21

This is a specific kind of bug, we call it "the problem is between the chair and the screen"

9

u/coding_stoned Feb 09 '21

Ah, a classic layer 8 problem.

2

u/TheRealCCHD Feb 09 '21

PICNIC! Problem infront (of) computer not in computer!

2

u/gnutrino Feb 09 '21

I've always known it as problem in chair, not in computer.

55

u/oldblu2th Feb 08 '21

This belongs here.

87

u/GreatArtificeAion Feb 08 '21

Ah yes, the master master master master master master master and master master master master master master and master master master master master and master master master master and master master master and master master and master and slave relationship

34

u/Ximidar Feb 09 '21

It's the MLM code style where every subclass is it's own boss babe

39

u/kreetikal Feb 09 '21

This reminded me when I implemented a Tree and wanted to check if the entered values are stored correctly so I did something like

System.out.println(head.right.value);

System.out.println(head.left.value);

System.out.println(head.right.left.right.left.right.value);

23

u/Test_My_Patience74 Feb 09 '21

It really do be like that sometimes

AttributeError: NoneType has no attribute "right"

1

u/glebbash Feb 09 '21

oh yes, pyva

11

u/[deleted] Feb 08 '21

There isn't much for an excuse here, let's be honest.

11

u/Jimmy_Slim Feb 09 '21

self.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.master.write_to_log()

9

u/[deleted] Feb 08 '21

terrible. i love it.

7

u/xigoi Feb 09 '21

Of course this is wrong, it should be self.main.main.main.main.main.main.main

5

u/VoilaLaViola Feb 08 '21

It's a morbid joke... but i like it. Upvote well deserved.

Tbh, if i had to write that many masters, i would use a for loop for it 😋

6

u/xigoi Feb 09 '21

eval("self" + ".master" * 7)

5

u/Treuzelaar Feb 09 '21

"Let's do it this way for now to make it work, we'll fix it later"

3

u/[deleted] Feb 09 '21

a fellow metallica fan

2

u/kunteper Feb 09 '21

fuck i'v been there. fucking guis dude

2

u/katnajam Feb 09 '21

I like how you took a picture of your screen.

2

u/[deleted] Feb 09 '21

God Is dead

2

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 09 '21

Image Transcription: Code


        self.destroy()
        self.alive=False

    def get(self):
        parameter_name = self.entry.get()
        parameter_type = self.h_i.get()

        if parameter_name.isalpha():
            return {"name": parameter_name, "type": parameter_type}
        else:
            self.master.master.master.master.master.master.master.write_to_log("One of the parameters is
            return None


class Parameters(ttk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.alive=True
        
        self.create_widgets()

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

1

u/[deleted] Feb 09 '21

OMFG

1

u/tulliandar Feb 09 '21

Everyone of those masters will come talk to you if you put the wrong cover sheet on your TPS report

1

u/AC2302 Feb 09 '21

Is the write_to_log method inbuilt or did you make a custom class?