无法访问QKeyEvent对象上的某些所谓的公共属性

时间:2018-12-14 07:45:57

标签: qml qkeyevent

此处有公共属性列表:http://doc.qt.io/qt-5/qkeyevent.html

我尝试访问它们:

def add(x,y):
    return x + y

我可以访问 Keys.onPressed: { console.log("matches: ", event.matches("=")); console.log("text: ", event.text()); console.log("native modifiers: ", event.nativeModifiers()); console.log("native scan code: ", event.nativeScanCode()); console.log("native virtual key: ", event.nativeVirtualKey()); } 属性,但不能访问其他属性。

matches

为什么?

1 个答案:

答案 0 :(得分:2)

因为您可以通过函数调用来访问属性。

只需使用def predict_retweets(dataset): tfidf = TfidfVectorizer(tokenizer=identity_tokenizer, stop_words='english', lowercase=False) keyword_response = tfidf.fit_transform(dataset['text']).toarray() X = keyword_response y = dataset['retweet_count'] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) regressor = LinearRegression() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) df = pd.DataFrame({'Actual': y_test, 'Predicted': y_pred}) print(df) return None