MarceloTerra0 / Notepad

A simple notepad made with PySimpleGUI, heavily inspired by https://github.com/israel-dryer
4 stars 0 forks source link

[ Enhancement Suggestion ] StatusBar - now works #1

Open PySimpleGUI opened 4 years ago

PySimpleGUI commented 4 years ago

For what it's worth, the StatusBar works correction after release 4.29.9

A new Demo Program was released that shows to how to implement one that sticks to the bottom of the window when the window is resized. Here's the code in case you need it.

import PySimpleGUI as sg

"""
    Demo Status Bar

    This demo shows you how to create your statusbar in a way that will keep it at the bottom of
    a resizeable window.  The key is the correct setting of the Expand settings for both the 
    StatusBar (done for you) and for a line above it that will keep it pushed to the bottom of the window.
    It's possible to also "simulate" a statusbar (i.e. use a text element or something else) by also
    configuring that element with the correct expand setting (X direction = True, expand row=True)

    Copyright 2020 PySimpleGUI.org
"""

def main():

    layout = [  [sg.Text('StatusBar Demo', font='ANY 15')],
                [sg.Text('This window has a status bar that is at the bottom of the window')],
                [sg.Text('The key to getting your bar to stay at the bottom of the window when')],
                [sg.Text('the window is resizeed is to insert a line of text (or some other element)')],
                [sg.Text('that is configured to expand.  ')],
                [sg.Text('This is accomplished by calling the "expand" method')],
                [sg.Text('')],
                [sg.Button('Ok'), sg.B('Quit')],
                [sg.Text(key='-EXPAND-', font='ANY 1', pad=(0,0))],  # thin row (font size 1) that expands and keeps bar at the bottom
                [sg.StatusBar('This is the statusbar')]]

    window = sg.Window('Vertical Layout Example', layout, resizable=True, finalize=True)

    window['-EXPAND-'].expand(True, True, True)     # needed to make the window expand in a way that will cause status to be at the bottom

    while True:
        event, values = window.read()
        if event in (sg.WINDOW_CLOSED, 'Quit'):   # if user closes window or clicks Quit
            break

if __name__ == '__main__':
    main()

This window is initially created

image

I you then resize the window, the status bar remains glued ot he bottom edge:

image

MarceloTerra0 commented 4 years ago

Well, I honestly didn't think that the official PySimpleGUI account would comment on my simple program. I'm flattered by it, but I can't see a reason for this post (that seems automated), since I didn't use the sg.StatusBar() command, nor did I tried coding a substitute for it.

PySimpleGUI commented 4 years ago

I wish I was capable of writing a bot that's this sophisticated, but I'm kinda booked up with this PySimpleGUI thing. I do think a bot requesting a screenshot be added to readmes would be a good addition.

It's honestly me, Mike, not a borg-Mike that posted.

I do realize your code and posts have no mention of a status bar. I wasn't sure if Israel skilled adding one initially because they kinda sucked back then. I thought that maybe you would be interesting in adding one. I see my Notepad++ uses one:

image

You can ignore the suggestion.

The reason I looked at your repo is that I go through many of the projects made with PySimpleGUI. I learn from people of all kinds. I learn new techniques. I learn how people are using it differently than me. I learn where some of the "soft" areas are that could be improved. In other words, while it may seem to you that I'm wasting time with your little project, it's just the opposite. I get something from doing this. I learn from people of all kinds and experience levels. Sometimes it's the entirely new people that have the freshest ideas and things I would have never thought to try, but they're like a child in some ways. They have a mind that's still curious and hasn't been polluted by the "norms" of the computing industry.

Like I said, it's a take it or leave it thing. Twas merely a suggestion, not a criticism. You're to be commended for doing anything with it at all. You're also to be commended for being really up front about how you got started by mentioning @israel-dryer in your repo. Many people don't do this.

Are you convinced yet I'm not a bot ;-)

Close the issue if it doesn't fit what you're wanting to do. I just thought I would toss it out there as a possibility if you're looking to expand a bit.

Take care -mike

MarceloTerra0 commented 4 years ago

As I said previously, I'm quite honored that you came into my repo. And now knowing that you're not a bot, I'm even more flattered!

I guess that I know where you're coming from, I feel the same about indie games/independent stuff, it's really fresh and there usually are some great ideas, that, even though they're not fully developed, it's awesome seeing something new. But I do think that my code was very primitive, so by reading through beginners repos, aren't you afraid that you can learn some "bad habits"? For instance, if I wrote something bad, but was the first one doing something like it, wouldn't it affect you negatively?

Also, thanks for bringing the StatusBar suggestion to me. PySimpleGUI is the best python GUI solution, and it can make almost every project be user friendly, so I don't see myself using anything other than it, so knowing more about it is always great.

As for implementing StatusBar into my notepad. I don't see myself expanding it's functionalities, since it was created just to teach me about PySimpleGUI, but I can assure you that I'll look into it in my future projects.

Thank you so so much for your attention, Sincerely -Marcelo

PySimpleGUI commented 4 years ago

I totally get projects that aren't meant to be continued or expanded. I've got a couple hundred of those in the form of Demo Programs. They're little learning exercises for me and users alike.

Another user mentioned learning from other users this past week in this Issue:

https://github.com/PySimpleGUI/PySimpleGUI/issues/3403

Yea, I've had it happen where I picked up a bad idea from a beginner. But, had I not tried the thing they did, I wouldn't have learned about it and learned it wasn't the great idea I thought it was.

Quick (ok, so it's not quick....) side-story and I'll leave you be.... PySimpleGUI wouldn't have happened if it weren't for the fact that I was a complete beginner in the GUI world. The "obviously right" way of creating a GUI architecture had not been burned into my brain. I was starting with a white sheet of paper without any preconceived notions on how a GUI framework should be architected.

This gave me freedom to go in any direction I wanted. Because I hadn't been trained to create GUIs in the same architecture as the other GUI frameworks, it enabled me to design and write PySimpleGUI in a way that was different than the others. I knew enough about tkinter to know that I didn't particularly care for that architecture and wanted something that worked better with how my brain works.

I'm not sure if being a beginner to Python was a benefit or not as I made some rookie errors with naming conventions since I didn't know about PEP8 when I started on it. What I do remember though is that I was incredibly enamored by lists and list comprehensions in Python. It was a novelty and so I looked extra hard for places to utilize it. Thus, the list-based layouts was born and everything else fell into place based on that being the core of PySimpleGUI.

Maybe part of the drive to make PySimpleGUI came from the newness of Python. I was excited to be learning and the excitement helped fuel the passion to stick with the project. I get that same kind of excitement from seeing other people's code work. In that case, the "how" they got their program to work was less important than the simple fact that it works.

I think that "discovery" plays a big part in computer science. Not everything is planned out ahead, at least not for me. Lots of things are discovered along the way. Beginners are capable of discovering new ideas and techniques just like experienced programmers do.

Just reading that you're excited about using PySimpleGUI has a benefit to the project. It gets me excited to work on it every day when I read messages from people just like you.

MarceloTerra0 commented 4 years ago

I'm actually embarrassed to be literally 1 month late, I'm so sorry for that. Some IRL stuff happened (and also some irresponsible gaming to be completely frank).

I'm so interested in hearing about your history with python (I'm sorry that it doesn't look lite it), because it shows me that not knowing about the PEP8 isn't as uncommon as I previously thought, I'm always kinda paranoid about a lot of stuff, being it if I should be using camel case of snake case for naming my functions, how my code should look like, stuff that makes me a bit unconfident about my programming skills and makes me think if I'll ever be able to do something useful to people, but seeing that you started like this as well fills me with determination (yes, an undertale reference).

Even though you're exceptional, I'm still curious about something. You had to begin somewhere, right? And if so, where did you begin? Which projects made a huge impact in your programming knowledge (or programming life as a whole)? I ask this because I feel like, even though I am capable of tacking some logic problems/small projects, I'm nowhere near to developing a medium scale project, and I even feel kinda scared by some github projects, because I just can't understand them. Even though python isn't rocket science, most often than not I'm jumping between the project files trying to understand how the program should work, why some files are where they are and stuff like that. So I'm looking forward to taking a new step, but I don't know where to.

I promise that I'll do my best to answer you as soon as possible from now on. (And please, don't feel like you're bothering me ("Quick (ok, so it's not quick....) side-story and I'll leave you be"), I'm really interested in hearing everything that you have to say)

PySimpleGUI commented 4 years ago

Hey, no pressure on any of this. We're having a nice casual conversation. Sometimes those span weeks or months on the internet. That doesn't make any part of it wrong. I didn't feel slighted or ignored or anything else. No expectations here.

Oy... my backstory...

My beginning was in 1978. I was 13 when I started programming and attending the University to learning CS (and to use their computer as home computers wouldn't be a thing I could afford for a few years more, so it was mainframes for me). Fortran wasn't running on home computers at that time anyway.

I quit a dishwashing job at 16 and started to code for $3.35/hour, minimum wage at the time. I wrote code on paper in the back of my high school classes most of the days. Graduated a year early, ran to University, and eventually got to Silicon Valley, from Kentucky, in 1983.

I knew the moment I wrote a piece of code that "this is what I'm meant to do". I'm really lucky to have found my calling early and that I've been obsessed with it since that day.

My learning process has been about 43 years long so far.

I've been lucky to have worked with some pioneers in the valley and saw a ton of situations. Wrote and shipped a lot of products in both software engineering and management roles.

The advice I give to others is to learn by making. Actually DO the thing you're trying to learn. I learned how to restore vintage mechanical watches by sitting my ass down in a chair for months, all night long and on every weekend. Crafts all feel like "10,000-hour" things to me. The piano is the same way. I learn by doing things, for real, not doing parts of them. I don't watch a piano tutorial and then play a couple of measures and call it quits.

I discovered/created PySimpleGUI because I was building a prototype for a new, patent-pending, video technology. I did not set out to write a GUI package. It was the LAST THING I had in mind. I had some specific tools I needed to write. I need a writer and a reader application. It just happened that while writing these tools, I didn't particularly like the experience I was having wring the GUI part. I was thoroughly enjoying my newly discovered language, Python, and all the fun, compact, get-it-done-in-a-line-of-code attributes it had.

I hadn't written GUI code since pre-windows days. I've never liked writing GUI code. Way back it was page after page of code and I'll be damned if it wasn't still page after page of code. For some crazy reason, I figured I could write a library that could make GUI programming so much easier. It would be quicker to do that and then write my GUI programs than it would be to write the GUI programs directly using tkinter or other GUI packages.

After writing my applications, I was surprised by how well this library I created worked. I knew it would be a hit, and I set about making it real.

My code sucks. It's getting better, but it's crippled by its early birth prior to me really understanding eh coding conventions, PEP8, etc. But, it's OK. It's good enough and it's taking people to all sorts of interesting places and that's all really exciting.

Anyway, yea, so that's how I got here more or less. I've got a big advantage of having spent a number of decades doing startups in the valley with very talented people that were generous in teaching me. Having over 40 years of my hands on a keyboard every day has to automatically produce some kind of positive result.

MarceloTerra0 commented 3 years ago

Here I am (late) again, but this time my delay has a purpose (kinda).

First of all, I'm the same about the calling, I've never had a single doubt in my whole life about my passion, and I'm really glad, since I have great friends that to this day don't have a single clue about what they want to do with their careers.

Knowing how hard it was to program in the earlier days, it amazes me how much you've been able to adapt to the current technologies, from writing code in a piece of paper to python. Most seniors tend to stick to a certain technology, be it COBOL, C++, C, etc. Why didn't you decide to stick to these technologies? (Since I believe that you have a great deal of experience in these areas) (And please, this isn't an insult or anything like that)

I'm amazed by the way that you created PySimpleGUI, since it was kinda created by accident, how did you feel while creating it? Because I feel that without any references, creating something from blank can be pretty scary, even more so for someone without much/any python experience.

And by practice makes it perfect, it's really true, I've been getting more confident over the past few months, I have a lot of projects that taught me WAY more that a course could, so I'm pretty excited about it.

And lastly, are you u/MikeTheWatchGuy? I would like to share something with you.

PySimpleGUI commented 3 years ago

Yea, that's me. What did I do this time? It's not been the most pleasant of experiences as of late.

MarceloTerra0 commented 3 years ago

I assure you it isn't anything bad lol, check your DM's on reddit.