Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Application stutters when running with an argument
Forum Updated to NodeBB v4.3 + New Features

Application stutters when running with an argument

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 231 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HK51503
    wrote on last edited by HK51503
    #1

    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 code

    from 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()
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What if you pop your custom argument from sys.argv ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HK51503
        wrote on last edited by
        #3

        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.

        JonBJ 1 Reply Last reply
        0
        • H HK51503

          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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @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 in app = 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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved