Python socket编程之六:多窗口的应用
Posted 佩雷尔曼的信徒
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python socket编程之六:多窗口的应用相关的知识,希望对你有一定的参考价值。
import struct import sqlalchemy import pandas import matplotlib.pyplot as Plot from matplotlib.finance import candlestick_ohlc as Drawk Engine = sqlalchemy.create_engine(\'mssql+pyodbc://sa:123456@XiTongDSN\') Dataframe = pandas.read_sql(\'sh\', Engine) I = list(Dataframe[\'date\'].index) O = Dataframe[\'open\'] H = Dataframe[\'high\'] L = Dataframe[\'low\'] C = Dataframe[\'close\'] V = Dataframe[\'volume\'] Quotes = [] for i in range(0, len(I)): Quotes.append((I[i], O[i], H[i], L[i], C[i], V[i])) figure = Plot.figure(\'Made by DengChaohai\') f1 = figure.add_subplot(3, 4, (1, 7), title = \'Index of Shanghai\') Drawk(f1, Quotes, colorup=\'g\', colordown=\'r\') Plot.grid(True) Plot.axis(\'tight\') f2 = figure.add_subplot(1, 4, 4, title = \'Quotes\') f2.text(0.2, 0.8, \'Bid2\', color = \'g\') f2.text(0.2, 0.6, \'Bid1\', color = \'g\') f2.text(0.2, 0.4, \'Ask1\', color = \'r\') f2.text(0.2, 0.2, \'Ask2\', color = \'r\') Plot.grid(True) f3 = figure.add_subplot(3, 4, (9, 11), title = \'Volume\') f3.bar(I, V, color = \'c\', edgecolor = \'c\') Plot.grid(True) Plot.axis(\'tight\') Plot.show()
以上是关于Python socket编程之六:多窗口的应用的主要内容,如果未能解决你的问题,请参考以下文章
爬坑Python 3.6 在 Socket 编程时出现类型错误 TypeError: a bytes-like object is required, not 'str'(示例代码(代