我是Kivy的新手,非常感谢您的帮助。我正在尝试使按钮“管理居民”切换屏幕,但出现错误:
// Draw a sine
var chartValues = new ChartValues<Point>();
for (int x = 0; x < 361; x++)
{
var point = new Point() {X = x, Y = Math.Sin(x * Math.PI / 180)};
chartValues.Add(point);
}
this.SeriesCollection = new SeriesCollection
{
// Set the line series color directly on the series object
new LineSeries
{
Title = "Yellow Series",
Values = chartValues,
Fill = Brushes.Yellow,
Stroke = Brushes.Blue
},
// Or use a Mapper which offers more flexibility e.g. allowing conditional coloring
new LineSeries
{
Title = "Mixed Color Series",
Configuration = new CartesianMapper<Point>()
.X(point => point.X)
.Y(point => point.Y)
.Stroke(point => point.X > 50 ? Brushes.Red : Brushes.LightGreen)
.Fill(point => point.X > 50 ? Brushes.Red : Brushes.LightGreen),
Values = chartValues
}
};
这是我的代码:
const file = [
{
name: "same",
hobby: '{ "name": "music", "type": "jazz" }'
},
];
let dd = []
file.forEach(
(it)=>{
let val = JSON.parse(it.hobby)
Object.keys(val).map(hby=>
{
dd.push({
name:it.name,
content:it.hobby,
content1:`h_${hby}`,
constent2:val[hby]
})
}
)})
console.log(dd)
这是应该更改屏幕的按钮
self.manager.current = 'manageResidents'
AttributeError: 'NoneType' object has no attribute 'current''
其余代码:
import sqlite3
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.dropdown import DropDown
from kivy.base import runTouchApp
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.textinput import TextInput
from kivy.properties import ObjectProperty
class mainMenu(Screen):
def __init__(self, **kwargs):
super(mainMenu, self).__init__(**kwargs)
# Selects the first name and last name of all residents and sorts by ascending order
db = sqlite3.connect("mainDatabase.db")
cursor = db.cursor()
dropDownValues = cursor.execute("SELECT firstName, lastName FROM residents ORDER BY firstName ASC").fetchall()
db.close()
mainDropdown = DropDown()#Assigns the variable mainDropdown to be a dropdown menu
答案 0 :(得分:0)
您的应用程序中有两个问题。