Progress Report 2

The tkinter GUI practice was good. But there is still a lot needed. Mostly in the way of looping it through a class. The class makes the most sense. That way I don't have to keep on making the same input box. But seeing as this is a progress report. Lets start with what is working.

This is the start of the code. Right now there is a standard box size of 400x400. A top line giving the opening statement, and two buttons. One to open a file to scrub. Another to exit. While this may seem rather simple. It opens up a whole word. The next two pictures show the sequence of what the GUI brings up.

After selecting the start button. It takes you to the open a file from your directory screen. As we have seen before. But the most import aspect is having the GUI buttons tie into the program. 

It opens the directory to where the program is placed. Which is nice because this will be a bunch of files together. The goal is to have it create its own directory. Then if I get far enough along. Even go as far as opening up dataloader.io and link into SF that way. Or atleast put the person right on the doorstep. Next picture up is the saving file.

We now have closed the starting window, and have opened up another window after the code has run. That is if the right csv file has been picked. I will start going through the actual meat of the program once I have all the command line inputs put into a nice looking GUI. But this brings us to the next point and thinking points. Below is the looping GUI code.

This code shows the power of making a class. It is essential the starting_GUI code. but this time it is just a tkinter class in which I can pass through different options. The real question is how to build out this class in a broadway so that I can continue looping myself through when I want. Till then the code below shows how to call the looping GUI and giving it options for text and buttons to display. 


I can now see why people might like using juypter note books to explain code. And or having a blog better display /  run the code that you are displaying. This is a good start to putting the GUI knowledge to use along with the Classes learned from actual class. More to come in this update. Just wanted to get some of the blog up that shows the initial coding before it all gets compiled into one looping class. So far the code is just getting cleaner and cleaner. 

 Update:

The code is getting cleaner and more complex all at the same time. I've decided to start adding in logic into the class creation. This way I can decide if I want button or not. Which is quite convenient. Essentially I am just using the class to get around tkinter being weird about displaying windows. And it is sorta working. I am just having trouble getting the input for the savefile.

It brings into the whole question of whether or not I should even let the user choose their filename. I could just hard code it with the radio buttons that I used. It would be easier to then index later. Which after typing this, I have convinced myself it is the way to go... Will figure this way out first. Because I'm sure it will come in handy later. I'm convinced it's just the way that I'm calling up the function. But we shall see.

Update:

After playing around with the GUI some more, I am finally happy with where I am. It works from start to finish. I have the GUI as a class all by itself, with different triggers. This seemed to make the most sense to reuse the class. Now All I have to do is feed it with a boolean statement and then the text. If there are buttons the class reads and displays it. Returning a value if the button has been clicked. So far all I have done is open the program. Ask them to start. Pick a file. Then the bulk of the code scrubs it. Then it returns back to a save file. Now the real question is whether or not to put the GUI into is own code so I can then call it. Making this whole expedition a little cleaner, plus then I could keep reusing my GUI class as a shell for other projects. That is most likely the route that will be taken a little later.

There needs to be more work on the magic logic. But I figure that I will learn that even better in the next few days between class and the other assignments. The picture above shows how the logic is being taken in to then call different functions in the class to display different results. It's great. Now I can call up a window, pass it the options I want and not worry about all the formatting. It's simple and reusable.


The next up added into this class was a little bit more interesting. It was adding the uploadfile and the saveasfile. These essentially just sit in the class using tkinter and I can call them up when I would like to. It'll get cleaner as the code evolve even more. But for now. This has given some smooth user inputs.

The next tasks are going to be making the meat of the program a little bit more robust. We shall see how that works. I might even try to see if I can program in some excel looks to see what it does.

There is also an idea to make my scrubbing dictionaries more editable. More to come. But for now this is a small victory.

- Update

To ease back in. I feel as though it is necessary to give this program some icons. It looks like a blank page at the bottom of my bar which confuses me at times. And there is something nice to a program looking nice. Adding to it's personal touch.

Back to watching John Elder from codemy.com. His stuff is super easy to follow and quite informative.

"Using Icons, Images, and Exit Buttons" Hour 1:18:25 https://www.youtube.com/watch?v=YXPyB4XeYLA

The icon file needs to be an ICO file that is a square. I'm going with 64 x 64. Brings me back to some good memories making goofy icons on 3D Paint.

 the code is simple enough. Just throw .iconbitmap onto the "root" that you are working with and make sure the file is in the same folder. 

 


This still leaves us with an ugly page on the status bar. So next up figuring that out.

This has led into a wild goose chase. The program works in pycharm, but isn't really opening well "with open" using python. The whole point is to make it so that people that don't know how to use python can control this program. Which has led to learning all sorts of things about tkinter. More up on these minor tweeks. The bugs seem to becoming from my class GUI buttons autofiring.






Comments