caret

Set default cursor position inside entry widget in Tkinter Python

吃可爱长大的小学妹 提交于 2020-01-20 07:47:10
问题 I want to set the default cursor location inside the entry widget when I run the program. So when I run it I don't have to click inside the widget to start typing. Can anyone help me with this? Actually I'm new at programming import tkinter as tk root = tk.Tk() e = tk.Entry(root) e.pack() tk.mainloop() 回答1: Simply call the focus method for the widget: import tkinter as tk root = tk.Tk() e = tk.Entry(root) e.pack() e.focus() tk.mainloop() 来源: https://stackoverflow.com/questions/59499960/set

Extract text from caret position textarea

一世执手 提交于 2020-01-17 04:08:21
问题 I am having trouble to extract text from textarea using WPF code behind. Example: Sunny day in London if the cursor is set on [d*ay] it should return day. * for the cursor. Any help will be appreciated. 回答1: This seems to work but I am not sure how you want it to behave when the caret is in the middle of whitespace. As is, it basically returns the nearest token that is touching the caret. For example, the phrase "Sunny day in London" has four tokens: "Sunny", "day", "in", and "London". string

Changing bootstrap caret(color and position)

老子叫甜甜 提交于 2020-01-12 06:41:51
问题 I want to change color of caret and make it not relative from input text, because it's hard to make it look good when it is. 回答1: There are two ways I have done this. If you want this to affect all carets on your site (probably not preferred) then you could override the caret css class in you: .caret{border-top:4px solid red;} Another option is to create a custom class and add it to the caret in your markup .red{border-top:4px solid red;} <div class="btn-group"> <button type="button" class=

Changing bootstrap caret(color and position)

时光毁灭记忆、已成空白 提交于 2020-01-12 06:41:28
问题 I want to change color of caret and make it not relative from input text, because it's hard to make it look good when it is. 回答1: There are two ways I have done this. If you want this to affect all carets on your site (probably not preferred) then you could override the caret css class in you: .caret{border-top:4px solid red;} Another option is to create a custom class and add it to the caret in your markup .red{border-top:4px solid red;} <div class="btn-group"> <button type="button" class=

How to get number of rows in ContentEditable area and current caret line position?

心不动则不痛 提交于 2020-01-10 03:58:10
问题 my question has two parts, but they are related. Firstly - I have Contenteditable DIV with some text and I need to get total number of rows (lines) of this DIV. Is it possible ? Secondly - I need to get caret row position, if it is on row number 1, 2, 3, etc.... Can anybody help ? 回答1: The direct answer is that there is no method that actually gets you those numbers. However, there are a number of different work arounds which you can apply to estimate (I use estimate , because I don't think

Get element node at caret position (in contentEditable)

蹲街弑〆低调 提交于 2020-01-09 03:26:44
问题 Let's say I have some HTML code like this: <body contentEditable="true"> <h1>Some heading text here</h1> <p>Some text here</p> </body> Now the caret (the blinking cursor) is blinking inside the <h1> element, let's say in the word "|heading" . How can I get the element the caret is in with JavaScript? Here I would like to get node name: "h1" . This needs to work only in WebKit (it's embedded in an application). It should preferably also work for selections. 回答1: Firstly, think about why you're

How to move cursor word by word in PhpStorm integrated terminal?

蹲街弑〆低调 提交于 2020-01-06 04:50:48
问题 I can't use my zsh shortcuts to move the caret by word in PhpStorm's integrated terminal window using i.e. ⌥ → like I use in Terminal App on my Mac. I have tried to use zsh as shell path in PhpStorm but my default zsh color scheme is not showing well inside of PhpStorm. Seems that also Mac Terminal->Settings shortcuts are not being enabled inside PhpStorm terminal. 回答1: I have found out that it work only if I bind the shortcuts directly in my ~/.bash_profile , by adding this at the bottom:

Get caret rect in content-editable UIWebView when it's on a blank line

↘锁芯ラ 提交于 2020-01-06 02:48:27
问题 For some reason, I need to get the caret vertical position in a content editable UIWebView. As many methods to do that stop caret blinking (for example when creating/removing a hidden node), I use this javascript/Objective-C code: - (CGRect)caretRect { NSString *js = @"function f(){ var sel = document.getSelection(); var range = sel.getRangeAt(0).cloneRange(); range.collapse(true); var r =range.getClientRects()[0]; return '{{'+r.left+','+r.top+'},{'+r.width+','+r.height+'}}'; } f();";

WPF TextBox selectall and show caret at the same time

和自甴很熟 提交于 2020-01-05 19:17:52
问题 after a long search on the net, I hope you can help me. My Problem: I want to select the complete text in a TextBox and will show the caret (blinking cursor) after the last character. Always I have found information about one problem or information to hide the caret. The separate things are no problems but the combination of it don't work. // Set the focus to the TextBox myTextBox.Focus(); // Select the complete text, but hide the caret (blinking cursor) myTextBox.SelectAll(); // or //

NSTextView caret size sometimes ignored

邮差的信 提交于 2020-01-05 03:51:25
问题 I'm changing the caret size using - (void)drawInsertionPointInRect:(NSRect)aRect color:(NSColor *)aColor turnedOn:(BOOL)flag . Anyway, when I move selection, the caret momentarily changes back to its default size. Is there another method that draws the caret that I need to override? What I'm currently doing : - (void)drawInsertionPointInRect:(NSRect)aRect color:(NSColor *)aColor turnedOn:(BOOL)flag { aRect.origin.y -= 1; aRect.origin.x -= 1; aRect.size.width += 1; aRect.size.height += 1;