#πŸ”’ Trouble with Tkinter.

12 messages Β· Page 1 of 1 (latest)

bleak cosmos
#

I have an entry widget that I'm trying to insert generated text into. It's just a string pulled froma pre-existing list, shouldn't be an issue.

however it is.

This is the whole project

https://github.com/Lokee86/npcGeneratorPublic

the code in question that's causing a problem is this

    def generate(self):
        fn.main(self.creature, self)
        self.genre_entry.delete(0, tk.END)
        self.genre_entry.insert(0, self.creature.genre)

in the the latest version this is at the bottom of the WindowMonster class in the window.py module. In earlier versions the logic is in the functionality.py module in the main() function or in generate_genre() function.

No matter where I put it, the insert function will only work intermittently. print() debugging and tracing has shown this is the problem, if it's something else I can't imagine what it would be. There is no such similar issue with inserting to the other fields that currently support it, which are Name and Stats.

You'll need an OpenAI style API to connect to to use the name generator, but the genre and stat generators are both just powered by the random lib.

Any insights would be helpful, I've been working on this for a while and I've run out of ideas.

GitHub

Contribute to Lokee86/npcGeneratorPublic development by creating an account on GitHub.

toxic cedarBOT
#

@bleak cosmos

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

meager hamlet
#

then simply .set() the var

bleak cosmos
#

how do you assign the variable to it?

#

nvm

#

ty

#

worked like a hot damn, thank you so much

meager hamlet
#

πŸ™‚

#

np!

toxic cedarBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.