为什么会出现这种错误?Gtk.TextView.scroll_to_iter()正好接受6个参数(给定3个)

2024-07-01 07:49:57 发布

您现在位置:Python中文网/ 问答频道 /正文

免责声明,我显然是个新手

我将数据发送到一个包含2条数据的函数,但我得到了错误:

Gtk.TextView.scroll_to_iter() takes exactly 6 arguments (3 given)

我玩过一些不同的东西,但在这里问

这是我的按钮,它调用函数:

def on_button_create_uuid_clicked(self, widget):
    self.log_output("New Code Generated. Press the 'Copy Code' button. \n", self.log_output)  # output to log

这就是功能:

def log_output(self, textToWrite, widget):
    textIter = self.logBuffer.get_end_iter()  # get_start_iter / get_end_iter for placing text at start or end of the buffer/textView
    self.logBuffer.insert(textIter, textToWrite)  # insert at the text iter point
    self.logView.scroll_to_iter(textIter, 0.1)  # scroll to the text iter  ((((((NOT WORKING!))))

因此,错误消息是:

TypeError: Gtk.TextView.scroll_to_iter() takes exactly 6 arguments (3 given)

这让我很困惑,因为我发送了两个参数,我的函数预期为3,但错误显示的数字却大不相同

现在这一定是因为我缺乏技能,但如果有人能帮助我理解我做错了什么,我洗耳恭听。目前我只是看不出我做错了什么

非常感谢


Tags: theto数据函数textselfloggtk

热门问题