Python - Flask and Tkinter()



  • The idea is, there's two musicians, one through. GUI by TkinterWeb-API (Flask).

    Write the code that starts. Flask with the function of Tkinterwith the buttons. The problem is if, for example, Flask starting first, not working. Tkinteruntil the process is over or killed Flaskafter that, it's only possible to control through Tkinterand vice versa.

    If the way to manage one or the other at the same time? In other words, it would be possible to control through a normal and normal way. GUI and WPI



  • That's the example of a swing and a flask.

    import flask
    import treading
    import Tkinter
    

    root = Tk()
    app = flask.Flask(name)

    #класс или функции самой программы

    def flask_main():
    #код для фласка писать тут
    app.run(port=5001) #запуск лупа

    def tk_main():
    #код для тк тут
    root.mainloop() #запуск лупа тк

    if name == "main":
    flt = treading.Tread(target=flask_main)
    flt.daemon = True
    flt.start() #фоновый процесс

    tk_main() #основной поток
    

    There's a new one next. In root.mainloop(s) may be blocked, making it impossible to process in the flash drive or vice versa.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2