zoukankan      html  css  js  c++  java
  • Test Python

    测试安装了下  Python, 语法真精简。怪不得现在很流行:

    下载:https://www.python.org/downloads/

    下载VS2012的一个IDE扩展插件PTVS: https://github.com/Microsoft/PTVS  或者用nuget搜需PTVS下载安装

    先需要设插件的环境选项。

    测试显示个窗口加了个按钮:

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    from tkinter import *           # 导入 Tkinter 库
    from tkinter import messagebox #对应着tkinter文件夹底下的messagebox.py
    from tkinter.messagebox import *
    top = Tk()
    top.geometry("500x200")
    def helloCallBack():
        showinfo( "Hello Python", "Hello Runoob")
    #   B = Button(top, text ="clicke me", fg="red",bg="blue",command = helloCallBack)
    B = Button(top, text ="clicke me",command = helloCallBack)
    B.pack()
    top.mainloop();
    

      

    OR:

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    from tkinter import *           # 导入 Tkinter 库
    from tkinter import messagebox #对应着tkinter文件夹底下的messagebox.py
    from tkinter.messagebox import *
    class Application(Frame):
        def __init__(self, master=None):
            Frame.__init__(self, master)
            self.pack()
            self.createWidgets()
    
        def createWidgets(self):
            self.nameInput = Entry(self)
            self.nameInput.pack()
            self.alertButton = Button(self, text='Hello', command=self.hello)
            self.alertButton.pack()
    
        def hello(self):
            name = self.nameInput.get() or 'world'
            messagebox.showinfo('Message', 'Hello, %s' % name)
    
    app = Application()
    app.master.title('Hello World')
    # 主消息循环:
    app.mainloop()
    

      

     这里是基础教学:https://www.runoob.com/python/python-tutorial.html

  • 相关阅读:
    BluetoothGetRadioInfo 函数
    BluetoothFindRadioClose 函数
    BluetoothFindNextRadio 函数
    BluetoothFindFirstRadio 函数
    BLUETOOTH_DEVICE_INFO 函数
    BluetoothSetServiceState 函数
    Bluetooth Functions
    union联合体学习
    置顶
    Toppo: 1
  • 原文地址:https://www.cnblogs.com/wgscd/p/12213702.html
Copyright © 2011-2022 走看看