如何将所有网格视图文本重置为null

时间:2018-09-02 12:08:43

标签: dart flutter

我正在打井字游戏。我已经构建了网格,它在x和o之间交替显示,两个游戏者可以从那里开始游戏。我也已经制定了游戏的条件和逻辑,但是在将单元格重置为import matplotlib.pyplot as plt import numpy as np import matplotlib.colors def categorical_cmap(nc, nsc, cmap="tab10", continuous=False): if nc > plt.get_cmap(cmap).N: raise ValueError("Too many categories for colormap.") if continuous: ccolors = plt.get_cmap(cmap)(np.linspace(0,1,nc)) else: ccolors = plt.get_cmap(cmap)(np.arange(nc, dtype=int)) cols = np.zeros((nc*nsc, 3)) for i, c in enumerate(ccolors): chsv = matplotlib.colors.rgb_to_hsv(c[:3]) arhsv = np.tile(chsv,nsc).reshape(nsc,3) arhsv[:,1] = np.linspace(chsv[1],0.25,nsc) arhsv[:,2] = np.linspace(chsv[2],1,nsc) rgb = matplotlib.colors.hsv_to_rgb(arhsv) cols[i*nsc:(i+1)*nsc,:] = rgb cmap = matplotlib.colors.ListedColormap(cols) return cmap data = np.random.randint(50,200, size=30) fig = plt.figure() cc = plt.cycler("color", categorical_cmap(6, 5, cmap="tab10").colors) with plt.style.context({"axes.prop_cycle" : cc}): ax = fig.add_subplot(121, aspect="equal") ax.pie(data) cc = plt.cycler("color", categorical_cmap(6, 5, cmap="gist_rainbow", continuous=True).colors) with plt.style.context({"axes.prop_cycle" : cc}): ax2 = fig.add_subplot(122, aspect="equal") ax2.pie(data) plt.show() 来开始新游戏时遇到了问题。使用null时,它会使用最后一次单击的单元格的索引并进行重置,而我想重置整个网格。我该怎么办??

GestureDetector

0 个答案:

没有答案