挽手叙旧

文章 评论 浏览 26

挽手叙旧 2025-02-20 14:03:03

formik.seterrors 应用于所有错误, {postalcode:'邮政编码中的错误'} 只是许多其他错误的特定错误,因此,当您将其设置为单独时,已经消除了所有其他字段的错误。

在这种情况下,您应该将其他字段的错误 formik.errors 与更新的错误一起。

formik.setErrors({ ...formik.errors, postalCode:'error in postal code' });

formik.setErrors is applied to all errors, {postalCode:'error in postal code' } is only a particular error of many other errors, so when you set it singularly that has wiped out all other fields' errors.

In this case, you should pass the other fields' errors formik.errors to that function along with your updated error.

formik.setErrors({ ...formik.errors, postalCode:'error in postal code' });

formik seterrors重置其他字段

挽手叙旧 2025-02-20 11:24:56

查看您在评论中提供的链接,您的模型定义看起来像这样:

class SegmentationModel(nn.Module):

  def __init__(self):
    super(SegmentationModel,self).__init__()

    self.arc = smp.Unet(
        encoder_name = ENCODER,
        encoder_weights = WEIGHTS,
        in_channels = 3,
        classes = 1,
        activation = None
    )

    def forward(self, images, masks = None):
      logits = self.arc(images)

      if masks != None:
        loss1 = DiceLoss(mode = 'binary')(logits, masks)
        loss2 = nn.BCEWithLogitsLoss()(logits,masks)
        return logits, loss1 + loss2

      return logits

如果您近距离看,您会看到 forward()具有不稳定的额外凹痕,使其成为内部功能 __ INIT __()而不是 SemengeationModel 的方法。将其转移到左侧,应该很好地工作:

class SegmentationModel(nn.Module):

  def __init__(self):
    super(SegmentationModel,self).__init__()

    self.arc = smp.Unet(
        encoder_name = ENCODER,
        encoder_weights = WEIGHTS,
        in_channels = 3,
        classes = 1,
        activation = None
    )

  def forward(self, images, masks = None):
    logits = self.arc(images)

    if masks != None:
      loss1 = DiceLoss(mode = 'binary')(logits, masks)
      loss2 = nn.BCEWithLogitsLoss()(logits,masks)
      return logits, loss1 + loss2

    return logits

Looking at the link you provided in the comment, your model definition looks like this:

class SegmentationModel(nn.Module):

  def __init__(self):
    super(SegmentationModel,self).__init__()

    self.arc = smp.Unet(
        encoder_name = ENCODER,
        encoder_weights = WEIGHTS,
        in_channels = 3,
        classes = 1,
        activation = None
    )

    def forward(self, images, masks = None):
      logits = self.arc(images)

      if masks != None:
        loss1 = DiceLoss(mode = 'binary')(logits, masks)
        loss2 = nn.BCEWithLogitsLoss()(logits,masks)
        return logits, loss1 + loss2

      return logits

If you look close, you'll see forward() has an erratic extra indentation, making it an internal function inside __init__() rather than a method of a SegmentationModel. Shift it a bit to left, and it should work fine:

class SegmentationModel(nn.Module):

  def __init__(self):
    super(SegmentationModel,self).__init__()

    self.arc = smp.Unet(
        encoder_name = ENCODER,
        encoder_weights = WEIGHTS,
        in_channels = 3,
        classes = 1,
        activation = None
    )

  def forward(self, images, masks = None):
    logits = self.arc(images)

    if masks != None:
      loss1 = DiceLoss(mode = 'binary')(logits, masks)
      loss2 = nn.BCEWithLogitsLoss()(logits,masks)
      return logits, loss1 + loss2

    return logits

如何在培训UNET模型中处理NotimplemplementError?

挽手叙旧 2025-02-20 09:41:06

模块查找是根据模块搜索路径进行的,您可以使用 PythonPath 环境变量覆盖该路径。例如,如果 modulec 是在/some/other/directory/modulec.py 中安装

PYTHONPATH=/some/other/directory python -m mymodule

的在搜索默认目录之前,代码>/某些/其他/目录。

请注意,Python并不真正支持在同一过程中使用在不同目录中安装的多个版本的模块。如果您只想使用 modulec myModule 的特定版本,但请使用同一脚本中其他位置的全系统版本,则必须安装两个版本 myModule 在不同的名称下。

Module lookup occurs based on your module search path, which you can override using the PYTHONPATH environment variable. For example, if moduleC is installed in /some/other/directory/moduleC.py, you could run

PYTHONPATH=/some/other/directory python -m mymodule

and python would first look in /some/other/directory for any module before searching the default directories.

Note that Python doesn't really support using multiple versions of modules installed in different directories in the same process. If you only wanted to use the specific version of moduleC for mymodule, but use the system-wide version elsewhere in the same script, you would have to install the two versions of mymodule under different names instead.

如何强制使用本地软件包来依赖?

挽手叙旧 2025-02-20 09:00:27

您尚未在代理机上安装git。

您可以下载最新版本的git 在这里,然后将其安装在代理机上。

成功完成安装后,重新启动机器或代理服务。然后,您可以在机器上或在代理上运行的管道作业中使用 git 命令。

You have not installed Git on the agent machine.

You can download the latest version of Git here, and then install it on the agent machine.

After completing the installation successfully, restart the machine or the agent service. Then you can use the git command on the machine or in the pipeline jobs which run on the agent.

嗨,我试图在自托管代理商上运行我的Azure管道,但会出现错误

挽手叙旧 2025-02-20 08:49:37

你做不到。
Google Analytics(分析)中保存的数据无法更改。

You can't do it.
The saved data in Google Analytics cannot be changed.

Google Analytics(分析) - 删除第二个URL

挽手叙旧 2025-02-20 08:25:03

我将使用gnu awk 进行此任务以下方式,让 file.txt

-1.3  -2.00  -3.00  4.00  9.00 
0.10  -0.20  -0.80  4.50  1.70
0.00  -3.40  -6.80  5.60  9.30
-0.4  -3.20  -4.70  0.80  -0.9
1.03  -2.00  -3.00  4.00  9.00 
0.00  -6.80  -9.30  3.40  5.60
0.00  -4.70  -0.80  8.90  -0.3

进行

awk '!($1=="0.00")' file.txt

输出

-1.3  -2.00  -3.00  4.00  9.00 
0.10  -0.20  -0.80  4.50  1.70
-0.4  -3.20  -4.70  0.80  -0.9
1.03  -2.00  -3.00  4.00  9.00 

说明:单个条件只需描述您想要的行:不(>) !)第一个字段( $ 1 )为( == )字符串 0.00 “ 0.00”

(已测试Gawk 4.2.1)

I would use GNU AWK for this task following way, let file.txt content be

-1.3  -2.00  -3.00  4.00  9.00 
0.10  -0.20  -0.80  4.50  1.70
0.00  -3.40  -6.80  5.60  9.30
-0.4  -3.20  -4.70  0.80  -0.9
1.03  -2.00  -3.00  4.00  9.00 
0.00  -6.80  -9.30  3.40  5.60
0.00  -4.70  -0.80  8.90  -0.3

then

awk '!($1=="0.00")' file.txt

gives output

-1.3  -2.00  -3.00  4.00  9.00 
0.10  -0.20  -0.80  4.50  1.70
-0.4  -3.20  -4.70  0.80  -0.9
1.03  -2.00  -3.00  4.00  9.00 

Explanation: single condition just describe lines which you want: not (!) first field ($1) is (==) string 0.00 ("0.00")

(tested in gawk 4.2.1)

当第一列包含等于零的值时删除行

挽手叙旧 2025-02-20 05:19:13
var MalathysStudents = studentlist.Where(s=>s.TeacherId==1).ToList();
var MalathysStudents = studentlist.Where(s=>s.TeacherId==1).ToList();

如何在C#中的对象列表中访问对象列表

挽手叙旧 2025-02-20 03:43:30

那一个人呢,

var string = "Please click on dashboard and then open the dashboard details to verify your details on the data";
const stringArray = string.split(' ');
var targetTexts = ["dashboard" , "dashboard" , "data"]
var replaceTexts = ["https://abcd.com/login" , "https://abcd.com/home" , "https://abcd.com/data"]

const resultArray = []
for (let i = 0; i < stringArray.length; i++) {
  const word = stringArray[i];
  const targetTextIndex = targetTexts.indexOf(word);
  
  if (targetTextIndex > -1) {
    resultArray.push("<a href='"+replaceTexts[targetTextIndex]+"'>"+word+"</a>")
    targetTexts = targetTexts.filter((_el, idx) => idx !== targetTextIndex)
    replaceTexts = replaceTexts.filter((_el, idx) => idx !== targetTextIndex)

  } else {
    resultArray.push(word);
  }
}

console.log(resultArray.join(' '))

我希望您对此有一个暗示。
它的工作就像魅力一样,将有例外处理供您处理。

How about this one guy,

var string = "Please click on dashboard and then open the dashboard details to verify your details on the data";
const stringArray = string.split(' ');
var targetTexts = ["dashboard" , "dashboard" , "data"]
var replaceTexts = ["https://abcd.com/login" , "https://abcd.com/home" , "https://abcd.com/data"]

const resultArray = []
for (let i = 0; i < stringArray.length; i++) {
  const word = stringArray[i];
  const targetTextIndex = targetTexts.indexOf(word);
  
  if (targetTextIndex > -1) {
    resultArray.push("<a href='"+replaceTexts[targetTextIndex]+"'>"+word+"</a>")
    targetTexts = targetTexts.filter((_el, idx) => idx !== targetTextIndex)
    replaceTexts = replaceTexts.filter((_el, idx) => idx !== targetTextIndex)

  } else {
    resultArray.push(word);
  }
}

console.log(resultArray.join(' '))

I hope you get a hint on this one.
It works like a charm, there will be exception handling for you to handle.

如何用一个替换术语安全地替换每个搜索,而前者是后者的一部分而不遇到再次替换此类搜索的一部分?

挽手叙旧 2025-02-19 19:51:57

如果您熟悉AWS,则可以创建一个具有20GB空间的EC2实例并在此安装MongoDB社区版,AWS提供了1年免费的层次
您可以在那里查看此链接,例如,类型您可以选择T2.Micro,它为您提供1GB RAM和1VCPU,

因此您可以尝试这是一种方法。认为这需要在安装MongoDB,确保它并拥有数据库的备份方面进行努力。因此,这取决于您喜欢哪个方向,使用自我管理的服务器或使用MongoDB Atlas(例如Mongodb Atlas)的托管服务。

If you are familiar with AWS, then you can create an EC2 instance with 20GB space and install MongoDB community edition there, AWS offer 1-year Free tier
You can check out there this Link, For instance type you can select t2.micro which provides you 1GB ram and 1vCPU

So this is one approach you can try. Thought it requires efforts in sense of installing MongoDB, securing it, and having a backup of the database. So it depends on which direction you prefer, using self-managed server or using managed service like MongoDB Atlas.

我可以在Heroku上没有Atlas的情况下部署MongoDB社区版

挽手叙旧 2025-02-19 10:01:00

这是一个非常简单的地方,可以使用列表理解来生成不包含任何关键字的项目列表。

>>> [f"{i}   {t}   {m}" for i, (t, m) in enumerate(zip(title, mama)) 
...                     if not any(w in m for w in filterkeywords)]
['0   SL C   slow cat Sas', '5   SL C   slow cat yan']
>>>

发电机表达式传递给任何是否存在任何关键字的工作。我们使用 zip 将标题和元素组合在妈妈中。 枚举提供索引。

This is a very straightforward place to use a list comprehension to generate a list of items that do not contain any of those keywords.

>>> [f"{i}   {t}   {m}" for i, (t, m) in enumerate(zip(title, mama)) 
...                     if not any(w in m for w in filterkeywords)]
['0   SL C   slow cat Sas', '5   SL C   slow cat yan']
>>>

The generator expression passed to any does the work of checking if any of the keywords are present. We used zip to combine the titles and elements in mama. And enumerate provides the index.

迭代并比较python中的两个列表,如果包含其他列表中的字符串,请流行项目

挽手叙旧 2025-02-18 18:48:23

不,无法以这种方式检测到。

以下不是便携式解决方案,但它在 gcc 12.1, clang 14.0和 msvc 19.32。它可能停止在以后的版本中工作。

您需要首先设置 errno = 0; ,然后检查范围错误:

#include <errno.h>

// ...

    errno = 0;
    f = scanf("%d",&i);
    if(f == 1 && errno != ERANGE) {
        // success
    }

对于可移植性,请从 C2X标准的早期草稿

除非*表示抑制分配抑制
转换结果。如果此对象没有适当的类型,或者如果转换的结果无法在对象中表示,则行为是未定义的

一个更好的(如 portable 中)检测到的选项是首先阅读到 char [] buffer,然后使用 strtol() 将其转换为数字。从相同的标准草稿中:

strtol strtoll strtoul strtoull 功能函数返回转换的值(如果有)。如果无法执行转换,则返回零。如果正确的值超出了表示值的范围,则 long_min long_max llong_min llong_max ulong_max ullong_max 被返回(根据该值的返回类型和符号(如果有)的符号),以及宏 erange 的值。在 errno 中。

这是一个使用 strtol()(转换为 long )的例证程序:

#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>

// A wrapper around `strtol` to convert to `int`
int strtoi(const char *str, char **str_end, int base) {
    int errno_save = errno;
    errno = 0; // clear it from any previous error (must be done)
    long result = strtol(str, str_end, base);
    if(errno == ERANGE) return result == LONG_MAX ? INT_MAX : INT_MIN;
    if(result > INT_MAX || result < INT_MIN) {
        errno = ERANGE;
        return result > INT_MAX ? INT_MAX : INT_MIN;
    }
    // success or no conversion could be performed
    errno = errno_save;  // restore errno
    return (int)result;
}
#define Size(x) (sizeof (x) / sizeof *(x))

int main(void) {
    const char* strings[] = {
        "3333333333333333333333 foo",
        "2147483647 will probably succeed",
        "2147483648 will probably fail",
        "32767 guaranteed success",
        "32767xyz",
        "xyz",
        "123",
        ""
    };

    char *end; // this will point at where the conversion ended in the string

    for(unsigned si = 0; si < Size(strings); ++si) {

        printf("testing \"%s\"\n", strings[si]);
        errno = 0; // clear it from any previous error (must be done)
        int result = strtoi(strings[si], &end, 10);

        if(errno == ERANGE) {
            perror(" to big for an int");
        } else if(strings[si] == end) {
            fprintf(stderr, " no conversion could be done\n");
        } else if(*end != '\0' && !isspace((unsigned char)*end)) {
            fprintf(stderr, " conversion ok,"
                            " but followed by a rouge character\n");
        } else {
            printf(" success: %d rest=[%s]\n", result, end);
        }
    }
}

可能的输出:

testing "3333333333333333333333 foo"
 to big for an int: Numerical result out of range
testing "2147483647 will probably succeed"
 success: 2147483647 rest=[ will probably succeed]
testing "2147483648 will probably fail"
 to big for an int: Numerical result out of range
testing "32767 guaranteed success"
 success: 32767 rest=[ guaranteed success]
testing "32767xyz"
 conversion ok, but followed by a rouge character
testing "xyz"
 no conversion could be done
testing "123"
 success: 123 rest=[]
testing ""
 no conversion could be done

No, it can't be detected that way.

The below is not a portable solution, but it works in 12.1, 14.0 and 19.32. It may stop working in later releases.

You need to set errno = 0; first and then check it for range errors:

#include <errno.h>

// ...

    errno = 0;
    f = scanf("%d",&i);
    if(f == 1 && errno != ERANGE) {
        // success
    }

For portability, read this from an early draft of the C2x standard:

Unless assignment suppression was indicated by a *, the result of the conversion is placed in the object pointed to by the first argument following the format argument that has not already received a
conversion result. If this object does not have an appropriate type, or if the result of the conversion cannot be represented in the object, the behavior is undefined.

A better (as in portable) option to detect this would be to read into a char[] buffer first and then use strtol() to convert it to a number. From the same standard draft:

The strtol, strtoll, strtoul, and strtoull functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN, LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type and sign of the value, if any), and the value of the macro ERANGE is stored in errno.

Here's a demonstrative program using strtol() (which converts to long):

#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>

// A wrapper around `strtol` to convert to `int`
int strtoi(const char *str, char **str_end, int base) {
    int errno_save = errno;
    errno = 0; // clear it from any previous error (must be done)
    long result = strtol(str, str_end, base);
    if(errno == ERANGE) return result == LONG_MAX ? INT_MAX : INT_MIN;
    if(result > INT_MAX || result < INT_MIN) {
        errno = ERANGE;
        return result > INT_MAX ? INT_MAX : INT_MIN;
    }
    // success or no conversion could be performed
    errno = errno_save;  // restore errno
    return (int)result;
}
#define Size(x) (sizeof (x) / sizeof *(x))

int main(void) {
    const char* strings[] = {
        "3333333333333333333333 foo",
        "2147483647 will probably succeed",
        "2147483648 will probably fail",
        "32767 guaranteed success",
        "32767xyz",
        "xyz",
        "123",
        ""
    };

    char *end; // this will point at where the conversion ended in the string

    for(unsigned si = 0; si < Size(strings); ++si) {

        printf("testing \"%s\"\n", strings[si]);
        errno = 0; // clear it from any previous error (must be done)
        int result = strtoi(strings[si], &end, 10);

        if(errno == ERANGE) {
            perror(" to big for an int");
        } else if(strings[si] == end) {
            fprintf(stderr, " no conversion could be done\n");
        } else if(*end != '\0' && !isspace((unsigned char)*end)) {
            fprintf(stderr, " conversion ok,"
                            " but followed by a rouge character\n");
        } else {
            printf(" success: %d rest=[%s]\n", result, end);
        }
    }
}

Possible output:

testing "3333333333333333333333 foo"
 to big for an int: Numerical result out of range
testing "2147483647 will probably succeed"
 success: 2147483647 rest=[ will probably succeed]
testing "2147483648 will probably fail"
 to big for an int: Numerical result out of range
testing "32767 guaranteed success"
 success: 32767 rest=[ guaranteed success]
testing "32767xyz"
 conversion ok, but followed by a rouge character
testing "xyz"
 no conversion could be done
testing "123"
 success: 123 rest=[]
testing ""
 no conversion could be done

scanf()无法检测到错误输入

挽手叙旧 2025-02-18 00:10:02

您必须使用 self.owner 而不是所有者()。如果要保留实例,则应附加 self


最小工作代码:

class Name:

    def __init__(self, first, last):
        self.first = first
        self.last = last

class Owner:

    def __init__(self, name):
        self.name = name
        self.pets = [] 

class Pet:

    def __init__(self, name, owner):
        self.name = name
        self.owner = owner
        self.owner.pets.append(self)
        
# --- main ---

person = Name('James', 'Bond')
owner = Owner(person)
pet1 = Pet("Lassie", owner)
pet2 = Pet("Kermit", owner)
pet3 = Pet("Jumbo", owner)

print('Owner:', owner.name.first, owner.name.last)
for pet in owner.pets:
    print('Pet  :', pet.name)
print('---')

print('Pet  :', pet1.name)
print('Owner:', pet1.owner.name.first, pet1.owner.name.last)
print('---')

print('Pet  :', pet2.name)
print('Owner:', pet2.owner.name.first, pet2.owner.name.last)
print('other Pets for the same Owner:')
for pet in pet2.owner.pets:
    if pet != pet2:
        print('  >', pet.name)
print('---')

结果:

Owner: James Bond
Pet  : Lassie
Pet  : Kermit
Pet  : Jumbo
---
Pet  : Lassie
Owner: James Bond
---
Pet  : Kermit
Owner: James Bond
other Pets for the same Owner:
  > Lassie
  > Jumbo
---

You have to use self.owner instead of Owner(). And if you want to keep instance then you should append self


Minimal working code:

class Name:

    def __init__(self, first, last):
        self.first = first
        self.last = last

class Owner:

    def __init__(self, name):
        self.name = name
        self.pets = [] 

class Pet:

    def __init__(self, name, owner):
        self.name = name
        self.owner = owner
        self.owner.pets.append(self)
        
# --- main ---

person = Name('James', 'Bond')
owner = Owner(person)
pet1 = Pet("Lassie", owner)
pet2 = Pet("Kermit", owner)
pet3 = Pet("Jumbo", owner)

print('Owner:', owner.name.first, owner.name.last)
for pet in owner.pets:
    print('Pet  :', pet.name)
print('---')

print('Pet  :', pet1.name)
print('Owner:', pet1.owner.name.first, pet1.owner.name.last)
print('---')

print('Pet  :', pet2.name)
print('Owner:', pet2.owner.name.first, pet2.owner.name.last)
print('other Pets for the same Owner:')
for pet in pet2.owner.pets:
    if pet != pet2:
        print('  >', pet.name)
print('---')

Result:

Owner: James Bond
Pet  : Lassie
Pet  : Kermit
Pet  : Jumbo
---
Pet  : Lassie
Owner: James Bond
---
Pet  : Kermit
Owner: James Bond
other Pets for the same Owner:
  > Lassie
  > Jumbo
---

尝试使用另一个类实例的初始化附加到另一个类列表

挽手叙旧 2025-02-17 07:05:26

SSH主持人不匹配confd。
我们再次复制了钥匙,然后开始工作

cp -f /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /opt/confd/etc/confd/ssh

the SSH hostkey were not matching in confd.
we copied the keys again and then it started to work

cp -f /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /opt/confd/etc/confd/ssh

钥匙交换尚未完成,连接与Ganymed-SSH-2和Cisco Confd关闭

挽手叙旧 2025-02-17 07:01:28

您是否尝试过胶带解决方案?

尝试确定何时发生错误,并使用简短的修复语句。它不是很漂亮,但是对于某些问题,它是唯一的解决方案,这是其中之一。

 if( (n * 0.1) < 100.0 ) { return n * 0.1 - 0.000000000000001 ;}
                    else { return n * 0.1 + 0.000000000000001 ;}

我在C#的科学模拟项目中也遇到了同样的问题,我可以告诉您,如果您忽略蝴蝶效应,它将转向一条大胖龙,并在A **中咬住您。

Did you try the duct tape solution?

Try to determine when errors occur and fix them with short if statements. It's not pretty, but for some problems it is the only solution and this is one of them.

 if( (n * 0.1) < 100.0 ) { return n * 0.1 - 0.000000000000001 ;}
                    else { return n * 0.1 + 0.000000000000001 ;}

I had the same problem in a scientific simulation project in C#, and I can tell you that if you ignore the butterfly effect, it's going to turn to a big fat dragon and bite you in the a**.

浮点数学破裂了吗?

挽手叙旧 2025-02-17 06:16:29

canvas.create_text正在显示图像下的文本,而不是在顶部。

我正在尝试创建_text并将其放在图像上,但是在运行时
我只能看到它甚至出现的代码,如果我在位置中创建它
0,0,位置400,263处的其他文本未显示(因为它
在图像下分层)

可以通过将字体大小减少到40和30来解决问题。并将canvas.create_text坐标设置为 canvas.create_text(120,30,...)而不是 canvas.create_text(0,0,...)

snippet:

from tkinter import *

window = Tk()
window.title("Flash Card")
window.config(pady=50, padx=50, background='green')

canvas = Canvas(width=800, height=526)
french_background = PhotoImage (file ="p2.png")
canvas.create_image(400, 263, image=french_background)
canvas.create_text(120, 30, text="French", fill= "black" , font=("Ariel", 40, "italic"))
canvas.create_text(400,263, text='random_french', fill="yellow", font=("Ariel",30,"bold"))
canvas.config(bg='red', highlightthickness=0)
canvas.grid(row=0, column=0, columnspan=2)

window.mainloop()

screenshot:

canvas.create_text is showing text under an image instead of on top.

I am trying to create_text and lay it over the image but when running
the code i can only see it even appears if i create it in position
0,0, the other text at position 400,263 does not shows (because it
layered under the image)

The problem can be fixed by reducing font sizes to 40 and 30. And set the canvas.create_text coordinates to canvas.create_text(120, 30,...) instead of canvas.create_text(0, 0, ...)

Snippet:

from tkinter import *

window = Tk()
window.title("Flash Card")
window.config(pady=50, padx=50, background='green')

canvas = Canvas(width=800, height=526)
french_background = PhotoImage (file ="p2.png")
canvas.create_image(400, 263, image=french_background)
canvas.create_text(120, 30, text="French", fill= "black" , font=("Ariel", 40, "italic"))
canvas.create_text(400,263, text='random_french', fill="yellow", font=("Ariel",30,"bold"))
canvas.config(bg='red', highlightthickness=0)
canvas.grid(row=0, column=0, columnspan=2)

window.mainloop()

Screenshot:

enter image description here

canvas.create_text正在显示图像下的文本,而不是在顶部显示

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文