« first day (4948 days earlier)   
04:00 - 05:0006:00 - 12:00

6:30 AM
oops sorry for no update, I fixed this a couple hrs ago
anyway, I thought that, when I switched tabs, the new content would show up in the exact same spot as the old content
obviouslly, that didn't happen even without any of the usual culprits, like margin, padding, or something like that; btw, it was supposed to be twitter bootstrap5 powered
 
Any CTKInter heads here? my button press will only run my function once.. even though I have implemented command= lambda- trying to figure out exactly what my issue is so I can solve it... would it be that I am catching return values from functions into variables and then using if loops to connect to my button and label? so the lambda function is rerunning if loops but not resetting values?
 
7:09 AM
@user24556897 It's hard to tell what the problem is without seeing your code. Can you create a MRE, eg on Pastebin, or a Github Gist, and link to it here?
I don't know what you mean by "if loops", since if statements aren't loops.
When a GUI function does run properly once but then stops responding, that can indicate that you have some misunderstanding of how event-driven programming works. So your code is trying to do stuff that would work in a non-GUI imperative program, but which isn't appropriate in an event-loop environment.
It takes some practice to get the hang of writing event-driven code. I find it best to start small. Write a very simple GUI program, and gradually add little features. Don't try to do anything too complicated while you're still learning.
 
7:43 AM
I assigned an instance of StringVar to the textvariable attribute of the Label widget- and I added the lambda function to the CTKButton- I think the issue is lines 164-167 as I am catching the return values of the functions- so although generate() is looping, the values are remaining the same?
It did previously work just with numgenlabel.set(snumlist) under def generate(): but when I added the if loop to account for my different checkboxes it stopped working
 
8:02 AM
@user24556897 I've never used customtkinter, and I haven't done any Tkinter stuff for a few years, so I'm a little rusty, but I'll take a look at your code. Even though it's not exactly Minimal...
 
8:20 AM
@user24556897 I'm sorry, but there are serious problems with your control flow. In an event-driven program, you set everything up, and then you finally call root.mainloop(). Then your program sits there, in the loop, waiting for events to respond to. Any imperative statements after the .mainloop() call won't be executed until after the loop is terminated. And usually in a GUI program that doesn't happen until the main window is closed.
I also noticed another issue. In Tkinter, the widget layout methods like .pack() return None. I assume customtkinter has the same behaviour. So checkbox1 = CTkCheckBox(master=frame, text= "Random", ...).pack(anchor="w", padx=(25, 0)) doesn't save the CheckBox widget as checkbox1.
It creates & packs the widget and just assigns None to checkbox1
 
8:38 AM
Here's a small example of using StringVar stackoverflow.com/a/38792997/4014959 Here are a few more. Some of them may be helpful examples. ;) stackoverflow.com/…
 
8:53 AM
@PM2Ring What would be your suggestion to improve control flow?
The checkboxes all function well- I am running into an issue with numgenlabel.set() it works once but doesn't work if you press the generate button a second time- but it did work before I implemented the if statements- so I think it is where I set the values that is breaking things? e.g. pbsnumlist_new
 
9:19 AM
generate only contains ifs and elifs. In the else case, the button doesn't do anything.
 
9:40 AM
@Aran-Fey There is no else!- I will add in an Else for Errors etc. but I am not getting any issues- in the if statements, I can switch between options and it works, I just can't do the same option twice
 
@user24556897 You need to move your processing logic into your callback functions, or into functions that the callbacks can call. Remember, your program is sitting inside the mainloop, eaiting for events. None of that code after that mainloop call can run (until the user closes the window.
I recommend putting your main program aside for a little while. Build a simple minimal version, without the polars stuff, etc. Just make a couple of simple widgets & labels, and try to get them to behave how you want. If you get stuck, it will be a lot easier for us to help you with that minimal program. Once you understand how to do that, you'll be able to apply those principles to your main program.
On line 115 you have pbcount. That doesn't look very useful...
 
10:00 AM
@PM2Ring It is for a loop to generate a longer series of numbers from the data- it is a bit redundant in the current state but I left it in so I can extend the numbers if needed :)
Fully agree with what you said about the minimal version- I did the minimal version prior- this is the step beyond that- it was all fine until I added the if statements in generate
@PM2Ring I think one of your linked examples will solve it for me- my brain doesn't function well at this time so I will have to run over it again in the morning. I feel very close to solving it!
 
10:55 AM
Hi,

Does 2to3 tool not refactor the deprecated functions of the string module?
 
Huh, I didn't know the string module had functions in it
 
04:00 - 05:0006:00 - 12:00

« first day (4948 days earlier)