This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15115|Reply: 1

[WPF] Visual Studio 2015 writes python interface

[Copy link]
Posted on 8/6/2018 6:10:21 PM | | |
import wpf
from System.Windows import Application, Window
from System.Windows import Application
from System.Windows import Window
from System.Threading import Thread
from System.Threading import ApartmentState
from System.Threading import ThreadStart

class MyWindow(Window):
    def __init__(self):
        wpf. LoadComponent(self, 'WpfApplication2.xaml')
def AppStartUp(sender, e):
    WpfApplication2 = Window()
    WpfApplication2.Title = "WPF From PythonNet!"
    WpfApplication2.Show()

def STAMain():
    app = Application()
    app. Startup += AppStartUp
    app. Run()

def main():

    t = Thread(ThreadStart(STAMain))

    t.ApartmentState = ApartmentState.STA

    t.Start()

    t.Join()
if __name__ == "__main__":
    main()

'''if __name__ == '__main__':
    Application(). Run(MyWindow())
'''




Previous:Tencent Cloud Drive Failure, Causing Users to "Completely Lose Data"
Next:Java development tool IntelliJ IDEA 2018 Chinese Chinese package download
Posted on 8/7/2018 9:19:15 AM |
I haven't tried it, I don't know if it's okay
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com