Application stutters when running with an argument
-
I'm trying to create an application with Pyside6. I added argument parser into my program so that I can pass a config file. But every time I run the program with the argument, a weird stuttering happens. Is there any way to prevent this?
https://youtu.be/IDOqfT04DPU (Video of it happening)
↓main python codefrom PySide6.QtWidgets import QApplication from window_main import MainWindow import sys import functions_match_config as conf import variables as var import argparse parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", help = "Add match config file.", required = False, default = "") args = parser.parse_args() if args.config: var.match_config_file_name = args.config conf.initialize() app = QApplication(sys.argv) window = MainWindow(app) window.show() app.exec()
-
Hi,
What if you pop your custom argument from
sys.argv
? -
Thanks for the reply. If I do that, will I be able to add other arguments in the future? It seems like it only takes values, not values and what option it came from.
@HK51503 said in Application stutters when running with an argument:
If I do that, will I be able to add other arguments in the future?
It seems like it only takes values, not values and what option it came from.
Don't know what you mean by either of these?
You have written code to accept a
-c
/--config
argument to your application, which you pass in. The first thing is to see whether if you remove that from the arguments seen inapp = QApplication(sys.argv)
that gets rid of whatever your "weird stuttering" is. I don't know why Qt seeing such an argument should affect behaviour since these are not Qt options (e.g. as per https://gist.github.com/pcolby/109550575dbd3dedbd4e1c3568929acd), so the first thing is to see whether this alters the behaviour.